Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete ooni_home_autorun on hard reset #295

Merged
merged 2 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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