1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

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
This commit is contained in:
Harvey Tindall 2023-06-11 16:05:31 +01:00
parent 456c99d7db
commit d688dd02c8
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2

View File

@ -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