detect shell from environment variable

This commit is contained in:
markt 2007-01-24 17:13:16 +00:00
parent a5ee8e9d91
commit 69bac5d56f
2 changed files with 10 additions and 1 deletions

View file

@ -1,5 +1,8 @@
(Format: Year/Month/Day)
Changes for 1.0rc3:
*07/01/24:
* Detect user's shell from environment rather than assuming /bin/sh (Mark)
FbCommands.cc
*07/01/21:
* Allow transparency in window buttons, so they show the titlebar underneath
instead of black (Mark)

View file

@ -143,12 +143,18 @@ int ExecuteCmd::run() {
sprintf(intbuff, "%d", screen_num);
// get shell path from the environment
// this process exits immediately, so we don't have to worry about memleaks
char *shell = getenv("SHELL");
if (!shell)
shell = "/bin/sh";
// remove last number of display and add screen num
displaystring.erase(displaystring.size()-1);
displaystring += intbuff;
setsid();
putenv(const_cast<char *>(displaystring.c_str()));
execl("/bin/sh", "/bin/sh", "-c", m_cmd.c_str(), static_cast<void*>(NULL));
execl(shell, shell, "-c", m_cmd.c_str(), static_cast<void*>(NULL));
exit(0);
return pid; // compiler happy -> we are happy ;)