aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2021-05-10 11:49:16 -0500
committerDevin J. Pohly <djpohly@gmail.com>2021-05-10 11:49:16 -0500
commit41bb7a7679595ca50ce2e34737ba09f9a28e6a54 (patch)
tree28d18eb1d1bb044246cda825dab49643604f65e9
parent2f39fb84ac737d5e09aac2f4462565c74825a287 (diff)
parent3f86336badecd7ced48db2a71ddcfb141fa5f39d (diff)
Merge branch 'pipe-status'
-rw-r--r--dwl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/dwl.c b/dwl.c
index c5308f5..d7e798b 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1809,15 +1809,22 @@ run(char *startup_cmd)
setenv("WAYLAND_DISPLAY", socket, 1);
if (startup_cmd) {
+ int piperw[2];
+ pipe(piperw);
startup_pid = fork();
if (startup_pid < 0)
EBARF("startup: fork");
if (startup_pid == 0) {
- dup2(STDERR_FILENO, STDOUT_FILENO);
+ dup2(piperw[0], STDIN_FILENO);
+ close(piperw[1]);
execl("/bin/sh", "/bin/sh", "-c", startup_cmd, NULL);
EBARF("startup: execl");
}
+ dup2(piperw[1], STDOUT_FILENO);
+ close(piperw[0]);
}
+ /* If nobody is reading the status output, don't terminate */
+ signal(SIGPIPE, SIG_IGN);
/* Run the Wayland event loop. This does not return until you exit the
* compositor. Starting the backend rigged up all of the necessary event