Mercurial > dwm-meillo
comparison util.c @ 9:d567f430a81d
fixed several stuff (gridwm gets better and better)
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Tue, 11 Jul 2006 12:52:57 +0200 |
parents | e0cefb3981c8 |
children | ea9c08ec4b48 |
comparison
equal
deleted
inserted
replaced
8:7066ff2fe8bc | 9:d567f430a81d |
---|---|
91 | 91 |
92 if(!cmd) | 92 if(!cmd) |
93 return; | 93 return; |
94 if(fork() == 0) { | 94 if(fork() == 0) { |
95 if(fork() == 0) { | 95 if(fork() == 0) { |
96 setsid(); | |
97 if(dpy) | 96 if(dpy) |
98 close(ConnectionNumber(dpy)); | 97 close(ConnectionNumber(dpy)); |
99 execlp(shell, "shell", "-c", cmd, NULL); | 98 setsid(); |
100 fprintf(stderr, "gridwm: execvp %s", cmd); | 99 fprintf(stderr, "gridwm: execlp %s %s -c %s", shell, shell, cmd); |
100 execlp(shell, shell, "-c", cmd, NULL); | |
101 fprintf(stderr, "gridwm: execlp %s", cmd); | |
101 perror(" failed"); | 102 perror(" failed"); |
102 } | 103 } |
103 exit (0); | 104 exit (0); |
104 } | 105 } |
105 wait(0); | 106 wait(0); |
121 perror("pipe"); | 122 perror("pipe"); |
122 exit(1); | 123 exit(1); |
123 } | 124 } |
124 | 125 |
125 if(fork() == 0) { | 126 if(fork() == 0) { |
126 setsid(); | |
127 if(dpy) | 127 if(dpy) |
128 close(ConnectionNumber(dpy)); | 128 close(ConnectionNumber(dpy)); |
129 setsid(); | |
129 dup2(pfd[1], STDOUT_FILENO); | 130 dup2(pfd[1], STDOUT_FILENO); |
130 close(pfd[0]); | 131 close(pfd[0]); |
131 close(pfd[1]); | 132 close(pfd[1]); |
132 execlp(shell, "shell", "-c", cmd, NULL); | 133 execlp(shell, shell, "-c", cmd, NULL); |
133 fprintf(stderr, "gridwm: execvp %s", cmd); | 134 fprintf(stderr, "gridwm: execlp %s", cmd); |
134 perror(" failed"); | 135 perror(" failed"); |
135 } | 136 } |
136 else { | 137 else { |
137 n = 0; | 138 n = 0; |
138 close(pfd[1]); | 139 close(pfd[1]); |