Tomas-M / xlunch

Graphical app launcher for X with minimal dependencies
http://xlunch.org
GNU General Public License v3.0
219 stars 37 forks source link

Zombie Child Processes #143

Open sodface opened 2 years ago

sodface commented 2 years ago

I'm using xlunch with the desktop and dontquit options and I was seeing a lot of processes with a Z state, a new one added each time I would press an xlunch icon and fire the associated action. I added the below patch and it seems to have fixed it, though I don't really know what I'm doing so there's likely a better approach.

https://github.com/Tomas-M/xlunch/blob/ec552702b22edee2733ee38e49740f5f9e4fd227/xlunch.c#L1105

--- ./xlunch.c.orig
+++ ./xlunch.c
@@ -38,6 +38,7 @@
 /* check stdin */
 #include <sys/poll.h>
 #include <errno.h>
+#include <sys/wait.h>

 /* some globals for our window & X display */
 Display *disp;
@@ -1103,6 +1104,7 @@
             /*FALLTHROUGH*/

         default:  /* Parent */
+            waitpid(pid, NULL, 0);
             reset_prompt();
             if (cmd != cmd_orig)
                 free(cmd);