我在Go中有一个应用程序,它可以重新路由二进制文件的STDIN和STDOUT,然后运行它们。简而言之,我正在做:

- 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

我注意到,只要在运行命令A时退出命令B的进程,它就会在进程表中变成僵尸进程。

这是一个例子:

commandA := exec.Command("samplebin")
commandB := exec.Command("sample2bin")

cmdAStdin := commandA.StdinPipe()

commandB.Stdout = cmdAStdin

commandA.Start()
commandB.Start()

如果commandB仍在运行时退出,为什么commandB会变成僵尸?我在Ubuntu 14上运行Go 1.5。