From f998705c5a0e50021875a811537962083b73ed26 Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Sun, 29 Oct 2023 18:34:27 +1300 Subject: feat: Pretty much done IPC Still need to add a program that uses the IPC, this potentially requires restructuring the files --- main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index eb5f8a9..1f3edc2 100644 --- a/main.cpp +++ b/main.cpp @@ -231,10 +231,6 @@ const void spawn(const CommandArg* argv) { if(fork() == 0) { - int null = open("/dev/null", O_WRONLY); - dup2(null, 0); - dup2(null, 1); - dup2(null, 2); const std::string argsStr = argv[0].str; vector args = split(argsStr, ' '); char** execvpArgs = new char*[args.size()]; @@ -242,6 +238,10 @@ const void spawn(const CommandArg* argv) { execvpArgs[i] = strdup(args[i].c_str()); } + int null = open("/dev/null", O_WRONLY); + dup2(null, 0); + dup2(null, 1); + dup2(null, 2); execvp(execvpArgs[0], execvpArgs); exit(0); } @@ -1083,6 +1083,8 @@ int main(int argc, char** argv) initEWMH(&dpy, &root, cfg.workspaces.size(), cfg.workspaces); setCurrentDesktop(1); + ipc.init(); + for(int i = 1; i < cfg.numWS + 1; i++) { vector v; @@ -1147,7 +1149,7 @@ int main(int argc, char** argv) if(ready == -1) { cout << "E" << endl; - cout << "ERROR" << endl; + log("ERROR"); } } -- cgit v1.2.3