internal: redirect exec'd app output to /dev/null (#9411)

This commit is contained in:
nyx 2025-02-15 08:51:17 -05:00 committed by GitHub
parent 3eb6cb1875
commit 7a6fde8414
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -967,6 +967,14 @@ uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWo
setenv(e.first.c_str(), e.second.c_str(), 1);
}
setenv("WAYLAND_DISPLAY", g_pCompositor->m_szWLDisplaySocket.c_str(), 1);
int devnull = open("/dev/null", O_WRONLY | O_CLOEXEC);
if (devnull != -1) {
dup2(devnull, STDOUT_FILENO);
dup2(devnull, STDERR_FILENO);
close(devnull);
}
execl("/bin/sh", "/bin/sh", "-c", args.c_str(), nullptr);
// exit grandchild
_exit(0);