diff options
| author | Dana Jansens <danakj@orodu.net> | 2002-07-26 09:21:17 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2002-07-26 09:21:17 +0000 |
| commit | d7bf31c5b5e449aab104da8ed7844b1023fa5d46 (patch) | |
| tree | 0c8afd05b4fa087889e807769d19741b5161d0cb | |
| parent | ca316865793bc9b4f1833cb7ab90c7dfc5dd9891 (diff) | |
make the execute process better
| -rw-r--r-- | util/epist/screen.cc | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/util/epist/screen.cc b/util/epist/screen.cc index e91685a8..1dc32f02 100644 --- a/util/epist/screen.cc +++ b/util/epist/screen.cc @@ -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"; |
