From 98ec296249bed7ce792a1ffe2ab029110f9296d8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 15 Sep 2022 12:28:06 +0200 Subject: [PATCH] Add exit code for controlled failures --- cmds/portmaster-start/run.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmds/portmaster-start/run.go b/cmds/portmaster-start/run.go index 588c6e9c..b37ba079 100644 --- a/cmds/portmaster-start/run.go +++ b/cmds/portmaster-start/run.go @@ -24,6 +24,11 @@ const ( // can return in order to trigger a restart after a clean shutdown. RestartExitCode = 23 + // ControlledFailureExitCode is the exit code that any service started by + // portmaster-start can return in order to signify a controlled failure. + // This disables retrying and exits with an error code. + ControlledFailureExitCode = 24 + exeSuffix = ".exe" zipSuffix = ".zip" ) @@ -431,6 +436,8 @@ func parseExitError(err error) (restart bool, errWithCtx error) { return true, fmt.Errorf("error during execution: %w", err) case RestartExitCode: return true, nil + case ControlledFailureExitCode: + return false, errors.New("controlled failure, check logs") default: return true, fmt.Errorf("unknown exit code %w", exErr) }