1
0
mirror of https://github.com/hyprwm/Hyprland.git synced 2025-08-20 14:33:47 -07:00

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

This commit is contained in:
nyx
2025-02-15 08:51:17 -05:00
committed by GitHub
parent 3eb6cb1875
commit 7a6fde8414

@@ -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);