]> Dogcows Code - chaz/openbox/blobdiff - util/epist/screen.cc
window resistance complete
[chaz/openbox] / util / epist / screen.cc
index e91685a89a68e2899da294ddcdf12ba00fd68c7d..1dc32f0231b566c1b8413973ceeff493a78e9275 100644 (file)
@@ -455,21 +455,13 @@ void screen::updateActiveWindow() {
 void screen::execCommand(const string &cmd) const {
   pid_t pid;
   if ((pid = fork()) == 0) {
-    extern char **environ;
-
-    char *const argv[] = {
-      "sh",
-      "-c",
-      const_cast<char *>(cmd.c_str()),
-      0
-    };
     // make the command run on the correct screen
     if (putenv(const_cast<char*>(_info->displayString().c_str()))) {
       cout << "warning: couldn't set environment variable 'DISPLAY'\n";
       perror("putenv()");
     }
-    execve("/bin/sh", argv, environ);
-    exit(127);
+    execl("/bin/sh", "sh", "-c", cmd.c_str(), NULL);
+    exit(-1);
   } else if (pid == -1) {
     cout << _epist->getApplicationName() <<
       ": Could not fork a process for executing a command\n";
This page took 0.025404 seconds and 4 git commands to generate.