st
simple terminal
git clone https://9o.is/git/st.git
commit a9f27fc369895659c05b9c50d3052068c4fb8a16 parent 59707e68a5512e52d39106a334f96e63feefbda8 Author: Jochen Sprickerhof <dwm@jochen.sprickerhof.de> Date: Wed, 22 Apr 2015 17:22:34 +0200 Fix sigchld Only wait for termination of the shell. Diffstat:
| M | st.c | | | 6 | +++++- |
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/st.c b/st.c @@ -1238,10 +1238,14 @@ execsh(void) { void sigchld(int a) { int stat, ret; + pid_t p; - if(waitpid(pid, &stat, 0) < 0) + if((p = waitpid(pid, &stat, WNOHANG)) < 0) die("Waiting for pid %hd failed: %s\n", pid, strerror(errno)); + if(pid != p) + return; + ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE; if (ret != EXIT_SUCCESS) die("child finished with error '%d'\n", stat);