jjzjj

linux - 父进程死亡时自动杀死子进程

这个问题在这里已经有了答案:EnsureexecutablescalledinGoProcessgetkilledwhenProcessiskilled(5个答案)关闭5年前。在Golang中,如何在父进程死亡时自动终止子进程?子进程由exec.Command()调用。例如,父进程pid为:28290,有3个子进程:32062、32473、33455。#psaxopid,ppid,pgid|grep28290PIDPPIDPGID28290128289320622829028289324732829028289334552829028289四个进程的PGID=28289相同。当我kil