How to exit a child process and return its status from execvp()?

后端 未结 3 982
轻奢々
轻奢々 2020-12-06 00:14

In my simple custom shell I\'m reading commands from the standard input and execute them with execvp(). Before this, I create a fork of the current process and I call the ex

3条回答
  •  爱一瞬间的悲伤
    2020-12-06 00:48

    Use wait() or waitpid() in the parent process. An example here: Return code when OS kills your process.

    Also, when a child dies the SIGCHLD signal is sent to the parent process.

提交回复
热议问题