Disable restarting on failure for UI components

This commit is contained in:
Daniel 2022-08-19 10:46:47 +02:00
parent 75d8639aa5
commit e9598520f0

View file

@ -46,6 +46,7 @@ type Options struct {
AllowDownload bool // allow download of component if it is not yet available AllowDownload bool // allow download of component if it is not yet available
AllowHidingWindow bool // allow hiding the window of the subprocess AllowHidingWindow bool // allow hiding the window of the subprocess
NoOutput bool // do not use stdout/err if logging to file is available (did not fail to open log file) NoOutput bool // do not use stdout/err if logging to file is available (did not fail to open log file)
RestartOnFail bool // Try restarting automatically, if the started component fails.
} }
func init() { func init() {
@ -56,6 +57,7 @@ func init() {
AllowDownload: true, AllowDownload: true,
AllowHidingWindow: true, AllowHidingWindow: true,
PIDFile: true, PIDFile: true,
RestartOnFail: true,
}, },
{ {
Name: "Portmaster App", Name: "Portmaster App",
@ -77,6 +79,7 @@ func init() {
AllowDownload: true, AllowDownload: true,
AllowHidingWindow: true, AllowHidingWindow: true,
PIDFile: true, PIDFile: true,
RestartOnFail: true,
}, },
}) })
} }
@ -213,7 +216,7 @@ func runAndRestart(opts *Options, args []string) error {
log.Printf("%s exited without error", opts.Identifier) log.Printf("%s exited without error", opts.Identifier)
} }
if !tryAgain { if !opts.RestartOnFail || !tryAgain {
return err return err
} }