Revert "Set child stdout and stderr to /dev/null (#1000)"

This reverts commit 1e5cab1ee7.

Breaks a bunch of stuff, e.g. Waybar.
This commit is contained in:
vaxerski 2022-11-13 19:53:27 +00:00
parent 549fdf63f6
commit 478fa7cafe

View file

@ -1,7 +1,5 @@
#include "KeybindManager.hpp" #include "KeybindManager.hpp"
#include <fcntl.h>
#include <paths.h>
#include <regex> #include <regex>
CKeybindManager::CKeybindManager() { CKeybindManager::CKeybindManager() {
@ -528,25 +526,6 @@ void CKeybindManager::spawn(std::string args) {
// run in grandchild // run in grandchild
close(socket[0]); close(socket[0]);
close(socket[1]); close(socket[1]);
close(STDOUT_FILENO);
close(STDERR_FILENO);
int devnull = open(_PATH_DEVNULL, O_WRONLY);
if (devnull == -1) {
Debug::log(LOG, "Unable to open /dev/null for writing");
return;
}
if (dup2(devnull, STDOUT_FILENO) == -1) {
Debug::log(LOG, "Unable to duplicate /dev/null to stdout");
return;
}
if (dup2(devnull, STDERR_FILENO) == -1) {
Debug::log(LOG, "Unable to duplicate /dev/null to stderr");
return;
}
close(devnull);
execl("/bin/sh", "/bin/sh", "-c", args.c_str(), nullptr); execl("/bin/sh", "/bin/sh", "-c", args.c_str(), nullptr);
// exit grandchild // exit grandchild
_exit(0); _exit(0);