diff options
author | nicm <nicm> | 2024-09-30 07:54:51 +0000 |
---|---|---|
committer | nicm <nicm> | 2024-09-30 07:54:51 +0000 |
commit | f95d055e04f129b015a46deb702081b8b87636ca (patch) | |
tree | ba4cd27f3a7da92b59eb5d212873d69389149095 | |
parent | 9bd039d1bc5f9109fb83fd2ed85e17d02908af19 (diff) |
Only use default-shell for popups, return to /bin/sh for run-shell,
if-shell and #() - these have been documented as using /bin/sh for a
long time and scripts rely on it. Pointed out by Gregory Pakosz.
-rw-r--r-- | job.c | 23 | ||||
-rw-r--r-- | popup.c | 2 |
2 files changed, 16 insertions, 9 deletions
@@ -71,9 +71,10 @@ static LIST_HEAD(joblist, job) all_jobs = LIST_HEAD_INITIALIZER(all_jobs); /* Start a job running. */ struct job * -job_run(const char *cmd, int argc, char **argv, struct environ *e, struct session *s, - const char *cwd, job_update_cb updatecb, job_complete_cb completecb, - job_free_cb freecb, void *data, int flags, int sx, int sy) +job_run(const char *cmd, int argc, char **argv, struct environ *e, + struct session *s, const char *cwd, job_update_cb updatecb, + job_complete_cb completecb, job_free_cb freecb, void *data, int flags, + int sx, int sy) { struct job *job; struct environ *env; @@ -83,6 +84,7 @@ job_run(const char *cmd, int argc, char **argv, struct environ *e, struct sessio sigset_t set, oldset; struct winsize ws; char **argvp, tty[TTY_NAME_MAX], *argv0; + struct options *oo; /* * Do not set TERM during .tmux.conf (second argument here), it is nice @@ -93,12 +95,17 @@ job_run(const char *cmd, int argc, char **argv, struct environ *e, struct sessio if (e != NULL) environ_copy(e, env); - if (s != NULL) - shell = options_get_string(s->options, "default-shell"); - else - shell = options_get_string(global_s_options, "default-shell"); - if (!checkshell(shell)) + if (~flags & JOB_DEFAULTSHELL) shell = _PATH_BSHELL; + else { + if (s != NULL) + oo = s->options; + else + oo = global_s_options; + shell = options_get_string(oo, "default-shell"); + if (!checkshell(shell)) + shell = _PATH_BSHELL; + } argv0 = shell_argv0(shell, 0); sigfillset(&set); @@ -718,7 +718,7 @@ popup_display(int flags, enum box_lines lines, struct cmdq_item *item, u_int px, pd->job = job_run(shellcmd, argc, argv, env, s, cwd, popup_job_update_cb, popup_job_complete_cb, NULL, pd, - JOB_NOWAIT|JOB_PTY|JOB_KEEPWRITE, jx, jy); + JOB_NOWAIT|JOB_PTY|JOB_KEEPWRITE|JOB_DEFAULTSHELL, jx, jy); pd->ictx = input_init(NULL, job_get_event(pd->job), &pd->palette); server_client_set_overlay(c, 0, popup_check_cb, popup_mode_cb, |