Pass stdin to child process. closes #3751
[arvados.git] / services / crunchstat / crunchstat.go
index d61871da6475dcdde342789069492e9e8dcfedf2..6eae22cdb91d2a7d7290d8dff59f51180d6a25be 100644 (file)
@@ -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 != "" {