summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2024-07-19 11:12:44 -0400
committerGitHub <noreply@github.com>2024-07-19 11:12:44 -0400
commit8282394bdc273a8b573fda7ea1e5a9e490978c6b (patch)
tree83b84102a7f079fd7b9792fb44322680ae3114aa /dwm.c
parent499d9e523a156e55511cee24ac30da9c0c9919fb (diff)
parent0485f1eb9c1624d443fbf14992d281336a859dce (diff)
Merge pull request #242 from fesowowako/masterHEADmaster
Merge Suckless Updates, Refactor Config.h and Enhance dwm Performance
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/dwm.c b/dwm.c
index 1ce854c..3173b37 100644
--- a/dwm.c
+++ b/dwm.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <spawn.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <X11/cursorfont.h>
@@ -1954,16 +1955,12 @@ sigchld(int unused)
while (0 < waitpid(-1, NULL, WNOHANG));
}
+extern char **environ;
+
void
spawn(const Arg *arg)
{
- if (fork() == 0) {
- if (dpy)
- close(ConnectionNumber(dpy));
- setsid();
- execvp(((char **)arg->v)[0], (char **)arg->v);
- die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]);
- }
+ posix_spawnp(NULL, ((char **)arg->v)[0], NULL, NULL, (char **)arg->v, environ);
}
void
@@ -2683,4 +2680,3 @@ main(int argc, char *argv[])
XCloseDisplay(dpy);
return EXIT_SUCCESS;
}
-