diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-09-01 14:40:33 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-09-01 14:40:33 +0000 |
commit | c089e19020a55d5df5887821dda30cb8281dcc75 (patch) | |
tree | a26172630578b4c6ef37c27dc08ebb442dc7d8ad /window.c | |
parent | 7d5e4947160d9355353c29a983e373b66c05abef (diff) | |
download | rtmux-c089e19020a55d5df5887821dda30cb8281dcc75.tar.gz rtmux-c089e19020a55d5df5887821dda30cb8281dcc75.tar.bz2 rtmux-c089e19020a55d5df5887821dda30cb8281dcc75.zip |
If forking a login shell or if SHELL is otherwise not useful, set it to the
default shell. Based on a diff from martynas@.
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -512,6 +512,11 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, log_close(); if (*wp->cmd != '\0') { + /* Set SHELL but only if it is currently not useful. */ + shell = getenv("SHELL"); + if (shell == NULL || *shell == '\0' || areshell(shell)) + setenv("SHELL", wp->shell, 1); + execl(_PATH_BSHELL, "sh", "-c", wp->cmd, (char *) NULL); fatal("execl failed"); } @@ -522,6 +527,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, xasprintf(&argv0, "-%s", ptr + 1); else xasprintf(&argv0, "-%s", wp->shell); + setenv("SHELL", wp->shell, 1); execl(wp->shell, argv0, (char *) NULL); fatal("execl failed"); } |