added redirect from stdout to stderr for spawned processes to prevent conflicts with the statusbar outputs

This commit is contained in:
David Donahue 2021-03-06 12:20:56 -06:00
parent 5b51bb82e2
commit 7cee5060bc

2
dwl.c
View file

@ -1846,6 +1846,7 @@ run(char *startup_cmd)
if (startup_pid < 0) if (startup_pid < 0)
EBARF("startup: fork"); EBARF("startup: fork");
if (startup_pid == 0) { if (startup_pid == 0) {
dup2(STDERR_FILENO, STDOUT_FILENO);
execl("/bin/sh", "/bin/sh", "-c", startup_cmd, NULL); execl("/bin/sh", "/bin/sh", "-c", startup_cmd, NULL);
EBARF("startup: execl"); EBARF("startup: execl");
} }
@ -2152,6 +2153,7 @@ void
spawn(const Arg *arg) spawn(const Arg *arg)
{ {
if (fork() == 0) { if (fork() == 0) {
dup2(STDERR_FILENO, STDOUT_FILENO);
setsid(); setsid();
execvp(((char **)arg->v)[0], (char **)arg->v); execvp(((char **)arg->v)[0], (char **)arg->v);
EBARF("dwl: execvp %s failed", ((char **)arg->v)[0]); EBARF("dwl: execvp %s failed", ((char **)arg->v)[0]);