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.
This commit is contained in:
nicm 2024-09-30 07:54:51 +00:00
parent 9bd039d1bc
commit f95d055e04
2 changed files with 16 additions and 9 deletions

23
job.c
View File

@ -71,9 +71,10 @@ static LIST_HEAD(joblist, job) all_jobs = LIST_HEAD_INITIALIZER(all_jobs);
/* Start a job running. */ /* Start a job running. */
struct job * struct job *
job_run(const char *cmd, int argc, char **argv, struct environ *e, struct session *s, job_run(const char *cmd, int argc, char **argv, struct environ *e,
const char *cwd, job_update_cb updatecb, job_complete_cb completecb, struct session *s, const char *cwd, job_update_cb updatecb,
job_free_cb freecb, void *data, int flags, int sx, int sy) job_complete_cb completecb, job_free_cb freecb, void *data, int flags,
int sx, int sy)
{ {
struct job *job; struct job *job;
struct environ *env; 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; sigset_t set, oldset;
struct winsize ws; struct winsize ws;
char **argvp, tty[TTY_NAME_MAX], *argv0; char **argvp, tty[TTY_NAME_MAX], *argv0;
struct options *oo;
/* /*
* Do not set TERM during .tmux.conf (second argument here), it is nice * 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) if (e != NULL)
environ_copy(e, env); environ_copy(e, env);
if (s != NULL) if (~flags & JOB_DEFAULTSHELL)
shell = options_get_string(s->options, "default-shell");
else
shell = options_get_string(global_s_options, "default-shell");
if (!checkshell(shell))
shell = _PATH_BSHELL; 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); argv0 = shell_argv0(shell, 0);
sigfillset(&set); sigfillset(&set);

View File

@ -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, pd->job = job_run(shellcmd, argc, argv, env, s, cwd,
popup_job_update_cb, popup_job_complete_cb, NULL, pd, 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); pd->ictx = input_init(NULL, job_get_event(pd->job), &pd->palette);
server_client_set_overlay(c, 0, popup_check_cb, popup_mode_cb, server_client_set_overlay(c, 0, popup_check_cb, popup_mode_cb,