-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(exec): redirect app output to /dev/null #9411
Conversation
Also it is the same as #1000 right? I also looked into this (and generally process spawning) |
i have tried before and after, this one fixes the problem where waybar does not spawn, the other one still has the same problem. not the same not sure why the original one causes the issue either tbh |
I used this on latest commit diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 8daa6838..768f3198 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -24,6 +24,8 @@
#include <string>
#include <string_view>
#include <cstring>
+#include <fcntl.h>
+#include <paths.h>
#include <hyprutils/string/String.hpp>
#include <hyprutils/os/FileDescriptor.hpp>
@@ -967,6 +969,22 @@ 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);
+ 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");
+ }
+
+ if (dup2(devnull, STDOUT_FILENO) == -1) {
+ Debug::log(LOG, "Unable to duplicate /dev/null to stdout");
+ }
+ if (dup2(devnull, STDERR_FILENO) == -1) {
+ Debug::log(LOG, "Unable to duplicate /dev/null to stderr");
+ }
+
+ close(devnull);
execl("/bin/sh", "/bin/sh", "-c", args.c_str(), nullptr);
// exit grandchild
_exit(0); And waybar opens just fine ??? |
Shouldn't they be functionally equivalent? Maybe opening devnull can fail?? |
i think the issue is that it does not open with an exec-once, not the fact that it doesnt open in general |
could you clarify which way you are talking about? ^^ |
shi* I forgot that I wrapped waybar in uwsm 🙃 |
skillz |
is it |
nope |
It's actually the closing of the stdin and stdout that breaks it. |
But if it works it works I guess. And stdin? Is it best to just leave it pointing to the tty/pts? |
ye |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel alive
fixes #9278
this is a better approach to #1000 and yes waybar opens lol unlike #1013