Browse Source
Kill internal process before removing sqlite folder
gre-patch-1
meriadec
6 years ago
No known key found for this signature in database
GPG Key ID: 1D2FC2305E2CB399
3 changed files with
23 additions and
1 deletions
-
src/commands/index.js
-
src/commands/killInternalProcess.js
-
src/helpers/reset.js
|
|
@ -15,6 +15,7 @@ import installFinalFirmware from 'commands/installFinalFirmware' |
|
|
|
import installMcu from 'commands/installMcu' |
|
|
|
import installOsuFirmware from 'commands/installOsuFirmware' |
|
|
|
import isDashboardOpen from 'commands/isDashboardOpen' |
|
|
|
import killInternalProcess from 'commands/killInternalProcess' |
|
|
|
import libcoreGetFees from 'commands/libcoreGetFees' |
|
|
|
import libcoreGetVersion from 'commands/libcoreGetVersion' |
|
|
|
import libcoreScanAccounts from 'commands/libcoreScanAccounts' |
|
|
@ -47,6 +48,7 @@ const all: Array<Command<any, any>> = [ |
|
|
|
installMcu, |
|
|
|
installOsuFirmware, |
|
|
|
isDashboardOpen, |
|
|
|
killInternalProcess, |
|
|
|
libcoreGetFees, |
|
|
|
libcoreGetVersion, |
|
|
|
libcoreScanAccounts, |
|
|
|
|
|
@ -0,0 +1,18 @@ |
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { createCommand, Command } from 'helpers/ipc' |
|
|
|
import { of } from 'rxjs' |
|
|
|
|
|
|
|
type Input = void |
|
|
|
type Result = boolean |
|
|
|
|
|
|
|
const cmd: Command<Input, Result> = createCommand('killInternalProcess', () => { |
|
|
|
setTimeout(() => { |
|
|
|
// we assume commands are run on the internal process
|
|
|
|
// special exit code for better identification
|
|
|
|
process.exit(42) |
|
|
|
}) |
|
|
|
return of(true) |
|
|
|
}) |
|
|
|
|
|
|
|
export default cmd |
|
|
@ -6,8 +6,10 @@ import resolveUserDataDirectory from 'helpers/resolveUserDataDirectory' |
|
|
|
import { disable as disableDBMiddleware } from 'middlewares/db' |
|
|
|
import db from 'helpers/db' |
|
|
|
import { delay } from 'helpers/promise' |
|
|
|
import killInternalProcess from 'commands/killInternalProcess' |
|
|
|
|
|
|
|
function resetLibcoreDatabase() { |
|
|
|
async function resetLibcoreDatabase() { |
|
|
|
await killInternalProcess.send().toPromise() |
|
|
|
const dbpath = path.resolve(resolveUserDataDirectory(), 'sqlite/') |
|
|
|
rimraf.sync(dbpath, { glob: false }) |
|
|
|
} |
|
|
|