From: Tom Clegg Date: Thu, 15 Nov 2018 21:24:48 +0000 (-0500) Subject: 14360: Merge branch 'master' X-Git-Tag: 1.4.0~180^2~30 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/df5c912a9eb5af7222e5446bc437ee97262542c8 14360: Merge branch 'master' Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- df5c912a9eb5af7222e5446bc437ee97262542c8 diff --cc services/crunch-run/crunchrun.go index 27fb8367f5,e5a1b94706..1c6c58009f --- a/services/crunch-run/crunchrun.go +++ b/services/crunch-run/crunchrun.go @@@ -1730,30 -1742,9 +1746,31 @@@ func main() `) memprofile := flag.String("memprofile", "", "write memory profile to `file` after running container") getVersion := flag.Bool("version", false, "Print version information and exit.") - checkContainerd := flag.Duration("check-containerd", 60*time.Second, "Periodic check if (docker-)containerd is running (use 0s to disable).") + flag.Duration("check-containerd", 0, "Ignored. Exists for compatibility with older versions.") + + detached := false + if len(os.Args) > 1 && os.Args[1] == "-detached" { + // This process was invoked by a parent process, which + // has passed along its own arguments, including + // -detach, after the leading -detached flag. Strip + // the leading -detached flag (it's not recognized by + // flag.Parse()) ... and remember not to detach all + // over again in this process. + os.Args = append([]string{os.Args[0]}, os.Args[2:]...) + detached = true + } ++ flag.Parse() + switch { + case *detach && !detached: + os.Exit(Detach(flag.Arg(0), os.Args, os.Stdout, os.Stderr)) + case *kill >= 0: + os.Exit(KillProcess(flag.Arg(0), syscall.Signal(*kill), os.Stdout, os.Stderr)) + case *list: + os.Exit(ListProcesses(os.Stdout, os.Stderr)) + } + // Print version information if requested if *getVersion { fmt.Printf("crunch-run %s\n", version)