Gaëtan Renaudeau
6 years ago
No known key found for this signature in database
GPG Key ID: 7B66B85F042E5451
2 changed files with
8 additions and
4 deletions
-
src/commands/killInternalProcess.js
-
src/helpers/reset.js
|
|
@ -1,10 +1,10 @@ |
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { createCommand, Command } from 'helpers/ipc' |
|
|
|
import { of } from 'rxjs' |
|
|
|
import { never } from 'rxjs' |
|
|
|
|
|
|
|
type Input = void |
|
|
|
type Result = boolean |
|
|
|
type Result = void |
|
|
|
|
|
|
|
const cmd: Command<Input, Result> = createCommand('killInternalProcess', () => { |
|
|
|
setTimeout(() => { |
|
|
@ -12,7 +12,8 @@ const cmd: Command<Input, Result> = createCommand('killInternalProcess', () => { |
|
|
|
// special exit code for better identification
|
|
|
|
process.exit(42) |
|
|
|
}) |
|
|
|
return of(true) |
|
|
|
// The command shouldn't finish now because process.exit will make it end!
|
|
|
|
return never() |
|
|
|
}) |
|
|
|
|
|
|
|
export default cmd |
|
|
|
|
|
@ -10,7 +10,10 @@ import libcoreReset from 'commands/libcoreReset' |
|
|
|
|
|
|
|
async function resetLibcore() { |
|
|
|
// we need to stop everything that is happening right now, like syncs
|
|
|
|
await killInternalProcess.send().toPromise() |
|
|
|
await killInternalProcess |
|
|
|
.send() |
|
|
|
.toPromise() |
|
|
|
.catch(() => {}) // this is a normal error due to the crash of the process, we ignore it
|
|
|
|
// we can now ask libcore to reset itself
|
|
|
|
await libcoreReset.send().toPromise() |
|
|
|
} |
|
|
|