X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/14f6c56b96fb8b7ccd104951f9e8374540f16fa5..9d1876405f50e009b686bce51c2469a52d2f79ca:/services/crunchstat/crunchstat.go diff --git a/services/crunchstat/crunchstat.go b/services/crunchstat/crunchstat.go index d61871da64..7adfaaa678 100644 --- a/services/crunchstat/crunchstat.go +++ b/services/crunchstat/crunchstat.go @@ -149,7 +149,7 @@ func PollCgroupStats(cgroup_root string, cgroup_parent string, container_id stri user_diff := next_user - last_user sys_diff := next_sys - last_sys // Assume we're reading stats based on 100 - // jiffies per second. Because the ellaspsed + // jiffies per second. Because the elapsed // time is in milliseconds, we need to boost // that to 1000 jiffies per second, then boost // it by another 100x to get a percentage, then @@ -241,7 +241,7 @@ func main() { logger := log.New(os.Stderr, "crunchstat: ", 0) if cgroup_root == "" { - logger.Fatal("Must provide either -cgroup-root") + logger.Fatal("Must provide -cgroup-root") } // Make output channel @@ -262,6 +262,10 @@ func main() { logger.Print("Running ", flag.Args()) + // Child process will read from our stdin pipe (we + // close our copy below) + cmd.Stdin = os.Stdin + // Forward SIGINT and SIGTERM to inner process term := make(chan os.Signal, 1) go func(sig <-chan os.Signal) { @@ -293,6 +297,9 @@ func main() { } } + // Close standard input in this (parent) process + os.Stdin.Close() + // Read the cid file var container_id string if cgroup_cidfile != "" {