about summary refs log tree commit diff stats
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/util.c b/util.c
index e29d8b0..990ad28 100644
--- a/util.c
+++ b/util.c
@@ -43,17 +43,20 @@ eprint(const char *errstr, ...)
 void
 spawn(Arg *arg)
 {
-	char **argv = (char **)arg->argv;
+	static char *shell = NULL;
 
-	if(!argv || !argv[0])
+	if(!shell && !(shell = getenv("SHELL")))
+		shell = "/bin/sh";
+
+	if(!arg->cmd)
 		return;
 	if(fork() == 0) {
 		if(fork() == 0) {
 			if(dpy)
 				close(ConnectionNumber(dpy));
 			setsid();
-			execvp(argv[0], argv);
-			fprintf(stderr, "dwm: execvp %s", argv[0]);
+			execl(shell, shell, "-c", arg->cmd, NULL);
+			fprintf(stderr, "dwm: execl '%s'", arg->cmd);
 			perror(" failed");
 		}
 		exit(0);
t;hut@lavabit.com> 2010-01-14 02:39:40 +0100 added install instructions' href='/akspecs/ranger/commit/INSTALL?h=v1.4.1&id=f51bd48a141e4886a48c4f3d498a1c329bbaf193'>f51bd48a ^
7582555b ^







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45