I have an application in Go that reroutes the STDIN and STDOUT of binaries and then runs them. In a nutshell I'm doing:
- create command object with the binary path (lets call the object command A)
- create command object with the binary path (calling it command B)
- set the stdout of command B to the stdin of Command A
- start command A
- start command B
I noticed whenever the process for command B exits while command A is running, it becomes a zombie process in the process table.
Here's an example:
commandA := exec.Command("samplebin")
commandB := exec.Command("sample2bin")
cmdAStdin := commandA.StdinPipe()
commandB.Stdout = cmdAStdin
commandA.Start()
commandB.Start()
Why does commandB become a Zombie if it exits while commandA is still running? I'm running Go 1.5 on Ubuntu 14.
signal.Ignore(syscall.SIGCHLD)
– Valene