Browse Source

bugfixes killInternalProcess

develop
Gaëtan Renaudeau 6 years ago
parent
commit
1c4b0fc073
No known key found for this signature in database GPG Key ID: 7B66B85F042E5451
  1. 7
      src/commands/killInternalProcess.js
  2. 5
      src/helpers/reset.js

7
src/commands/killInternalProcess.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

5
src/helpers/reset.js

@ -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()
}

Loading…
Cancel
Save