fix(miniooni): handle panics with --repeat-every (#914)

Most of miniooni panics on errors. We should not panic on error with
--repeat-every, rather we should try the next measurement.

See https://github.com/ooni/probe/issues/2250
This commit is contained in:
Simone Basso 2022-08-31 13:07:24 +02:00 committed by GitHub
commit a8a29cc0dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -17,7 +17,10 @@ func acquireUserConsent(miniooniDir string, currentOptions *Options) {
consentFile := path.Join(miniooniDir, "informed")
err := maybeWriteConsentFile(currentOptions.Yes, consentFile)
runtimex.PanicOnError(err, "cannot write informed consent file")
runtimex.PanicIfFalse(regularFileExists(consentFile), riskOfRunningOONI)
runtimex.PanicIfFalse(
regularFileExists(consentFile),
riskOfRunningOONI,
)
}
// maybeWriteConsentFile writes the consent file iff the yes argument is true
@ -30,6 +33,7 @@ func maybeWriteConsentFile(yes bool, filepath string) (err error) {
// riskOfRunningOONI is miniooni's informed consent text.
const riskOfRunningOONI = `
Do you consent to OONI Probe data collection?
OONI Probe collects evidence of internet censorship and measures