From 69bac5d56ff60dfce108e3a25270aab8eaf2b345 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 24 Jan 2007 17:13:16 +0000 Subject: detect shell from environment variable --- ChangeLog | 3 +++ src/FbCommands.cc | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 63a3452..d889d42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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) diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 83025ec..5fbceab 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc @@ -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(displaystring.c_str())); - execl("/bin/sh", "/bin/sh", "-c", m_cmd.c_str(), static_cast(NULL)); + execl(shell, shell, "-c", m_cmd.c_str(), static_cast(NULL)); exit(0); return pid; // compiler happy -> we are happy ;) -- cgit v0.11.2