X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fscreen.cc;h=1dc32f0231b566c1b8413973ceeff493a78e9275;hb=b9e40b8b1e055baa6a806c56206eb0baccd7ce0a;hp=80a579cc2d0e0c5fdeacb9249a8f513af8260691;hpb=fa34ea5250511e37180ea2ddd85919516f25248d;p=chaz%2Fopenbox diff --git a/util/epist/screen.cc b/util/epist/screen.cc index 80a579cc..1dc32f02 100644 --- a/util/epist/screen.cc +++ b/util/epist/screen.cc @@ -65,7 +65,7 @@ screen::screen(epist *epist, int number) _managed = false; while (! (_epist->doShutdown() || _managed || count <= 0)) { if (! (_managed = findSupportingWM())) - usleep(1000); + sleep(1); --count; } if (_managed) @@ -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(cmd.c_str()), - 0 - }; // make the command run on the correct screen if (putenv(const_cast(_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"; @@ -523,6 +515,7 @@ void screen::cycleWindow(const bool forward, const bool allscreens, // found a good window! t->focus(); + return; } }