How to make child process die after parent exits?

后端 未结 24 2194
天涯浪人
天涯浪人 2020-11-22 05:31

Suppose I have a process which spawns exactly one child process. Now when the parent process exits for whatever reason (normally or abnormally, by kill, ^C, assert failure o

24条回答
  •  無奈伤痛
    2020-11-22 06:21

    I've passed parent pid using environment to the child, then periodically checked if /proc/$ppid exists from the child.

提交回复
热议问题