fix(startup): make watchdog task keep agent alive
- Use Task Scheduler XML instead of /TR - Run -ensure agent in-process, not child - Add console close and panic protection - Guard nil event channels after stop - Add non-Windows stubs for startup/mutex
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package instance
|
||||
|
||||
import "strings"
|
||||
|
||||
func filterArgs(args []string) []string {
|
||||
out := make([]string, 0, len(args))
|
||||
for _, arg := range args {
|
||||
name := strings.TrimLeft(arg, "-/")
|
||||
lower := strings.ToLower(name)
|
||||
switch {
|
||||
case lower == "background" || strings.HasPrefix(lower, "background="):
|
||||
continue
|
||||
case lower == "foreground" || strings.HasPrefix(lower, "foreground="):
|
||||
continue
|
||||
case lower == "ensure" || strings.HasPrefix(lower, "ensure="):
|
||||
continue
|
||||
}
|
||||
out = append(out, arg)
|
||||
}
|
||||
return out
|
||||
}
|
||||
Reference in New Issue
Block a user