From d688dd02c81d7786683c2df0959a63371465cc1c Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sun, 11 Jun 2023 16:05:31 +0100 Subject: [PATCH] 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 --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index d1fd84e..12df585 100644 --- a/main.go +++ b/main.go @@ -613,9 +613,13 @@ func (app *appContext) shutdown() { } func flagPassed(name string) (found bool) { - for _, f := range os.Args { + for i, f := range os.Args { if f == name { found = true + // Remove the flag, to avoid issues wit the flag library. + os.Args = append(os.Args[:i], os.Args[i+1:]...) + return + } } return