args: respect other args when start/stop/daemon are used

these being present in os.Args messes up "flag"'s parsing of the rest of
the arguments, so when they are found, they are removed.

Fixes #267
pull/270/head
Harvey Tindall 1 year ago
parent 456c99d7db
commit d688dd02c8
No known key found for this signature in database
GPG Key ID: BBC65952848FB1A2

@ -613,9 +613,13 @@ func (app *appContext) shutdown() {
} }
func flagPassed(name string) (found bool) { func flagPassed(name string) (found bool) {
for _, f := range os.Args { for i, f := range os.Args {
if f == name { if f == name {
found = true found = true
// Remove the flag, to avoid issues wit the flag library.
os.Args = append(os.Args[:i], os.Args[i+1:]...)
return
} }
} }
return return

Loading…
Cancel
Save