Skip to content

Commit

Permalink
Merge pull request #295 from ooni/2071/reset-ooni-home-autorun
Browse files Browse the repository at this point in the history
Delete ooni_home_autorun on hard reset
  • Loading branch information
hellais authored Jul 7, 2022
2 parents 77659af + 09c9c29 commit d91033a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions main/actions.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
const { Ooniprobe } = require('./utils/ooni/ooniprobe')
const { getAutorunHomeDir } = require('./utils/paths')
const log = require('electron-log')
const Sentry = require('@sentry/electron')

const hardReset = () => {
const ooni = new Ooniprobe()
const ooniHome = new Ooniprobe()
const ooniAutorunHome = new Ooniprobe()
log.info('hardReset: performing a hard reset of the installation')
return ooni.call(['reset', '--force'])

return Promise.all([
ooniHome.call(['reset', '--force']),
ooniAutorunHome.call(['reset', '--force'], {'OONI_HOME': getAutorunHomeDir()})
])
}

const listMeasurements = (resultID) => {
Expand Down
5 changes: 3 additions & 2 deletions main/utils/ooni/ooniprobe.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Ooniprobe extends EventEmitter {
this.ooni.stdin.end()
}

call(argv) {
call(argv, env) {
const self = this
if (self.ooni !== null) {
throw Error('can only use call once per instance. Create a new Oooniprobe object!')
Expand All @@ -61,7 +61,8 @@ class Ooniprobe extends EventEmitter {
'OONI_HOME': getHomeDir(),
// See https://github.com/ooni/probe-cli/pull/111 for documentation
// concerning the design of killing ooniprobe portably
'OONI_STDIN_EOF_IMPLIES_SIGTERM': 'true'
'OONI_STDIN_EOF_IMPLIES_SIGTERM': 'true',
...env,
}
}
if (is.windows) {
Expand Down

0 comments on commit d91033a

Please sign in to comment.