diff options
author | mathias <mathias> | 2007-06-06 06:22:37 (GMT) |
---|---|---|
committer | mathias <mathias> | 2007-06-06 06:22:37 (GMT) |
commit | dff2aa33561b00e97b3561892fb690ba9f2968c6 (patch) | |
tree | e1cde447e834f5fe2cb7bbc3fd3fbd4f78c35de7 /util | |
parent | 467cb9ac6d951bbd37cb809370fa2e5b27f7e032 (diff) | |
download | fluxbox_paul-dff2aa33561b00e97b3561892fb690ba9f2968c6.zip fluxbox_paul-dff2aa33561b00e97b3561892fb690ba9f2968c6.tar.bz2 |
fix for the following problem:
on *bsd /bin/sh is not just a symlink to /bin/bash as on most linux's
but a real standalone shell. and it behaves differently from "bash -c"
behavior .. it doesnt exec the command given but waits till the command
finishes. as a result a lot of "rogue" a flying around. solution is now
( $SHELL or /bin/sh ) -c exec <cmd>
Diffstat (limited to 'util')
-rw-r--r-- | util/fbrun/FbRun.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc index 7797f76..95cb94d 100644 --- a/util/fbrun/FbRun.cc +++ b/util/fbrun/FbRun.cc | |||
@@ -119,8 +119,15 @@ void FbRun::run(const std::string &command) { | |||
119 | 119 | ||
120 | // fork and execute program | 120 | // fork and execute program |
121 | if (!fork()) { | 121 | if (!fork()) { |
122 | |||
123 | char *shell = getenv("SHELL"); | ||
124 | if (!shell) | ||
125 | shell = "/bin/sh"; | ||
126 | |||
127 | std::string exec_cmd = "exec " + command; | ||
128 | |||
122 | setsid(); | 129 | setsid(); |
123 | execl("/bin/sh", "/bin/sh", "-c", command.c_str(), static_cast<void*>(NULL)); | 130 | execl(shell, shell, "-c", exec_cmd.c_str(), static_cast<void*>(NULL)); |
124 | exit(0); //exit child | 131 | exit(0); //exit child |
125 | } | 132 | } |
126 | 133 | ||