diff --git a/internal/cmd/miniooni/consent.go b/internal/cmd/miniooni/consent.go index c8862c50d1..70a66266c2 100644 --- a/internal/cmd/miniooni/consent.go +++ b/internal/cmd/miniooni/consent.go @@ -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 diff --git a/internal/cmd/miniooni/libminiooni.go b/internal/cmd/miniooni/main.go similarity index 96% rename from internal/cmd/miniooni/libminiooni.go rename to internal/cmd/miniooni/main.go index b132a192a7..ab5d081cf4 100644 --- a/internal/cmd/miniooni/libminiooni.go +++ b/internal/cmd/miniooni/main.go @@ -7,6 +7,7 @@ import ( "fmt" "os" "path" + "runtime/debug" "strings" "time" @@ -287,6 +288,17 @@ func MainWithConfiguration(experimentName string, currentOptions *Options) { // mainSingleIteration runs a single iteration. There may be multiple iterations // when the user specifies the --repeat-every command line flag. func mainSingleIteration(logger model.Logger, experimentName string, currentOptions *Options) { + + // We allow the inner code to fail but we stop propagating the panic here + // such that --repeat-every works as intended anyway + if currentOptions.RepeatEvery > 0 { + defer func() { + if r := recover(); r != nil { + log.Warnf("recovered from panic: %+v\n%s\n", r, debug.Stack()) + } + }() + } + extraOptions := mustMakeMapStringAny(currentOptions.ExtraOptions) annotations := mustMakeMapStringString(currentOptions.Annotations)