From 9fcd9c718a2250e38be478f567f5e060850b6514 Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Tue, 23 May 2023 12:24:12 +1200 Subject: Redirecting fd 0 for children to /dev/null aswell --- main.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index efd42dc..d367ead 100644 --- a/main.cpp +++ b/main.cpp @@ -203,6 +203,7 @@ void spawn(const KeyArg arg) if(fork() == 0) { int null = open("/dev/null", O_WRONLY); + dup2(null, 0); dup2(null, 1); dup2(null, 2); const std::string argsStr = arg.str; @@ -497,6 +498,7 @@ void bashSpawn(const KeyArg arg) if(fork() == 0) { int null = open("/dev/null", O_WRONLY); + dup2(null, 0); dup2(null, 1); dup2(null, 2); system(arg.str); @@ -1023,5 +1025,7 @@ int main(int argc, char** argv) } } + //Kill children + XCloseDisplay(dpy); } -- cgit v1.2.3