mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 11:18:48 +00:00
If we successfully change the directory, set PWD too to give the shell a
hint in case of symlinks.
This commit is contained in:
parent
a2681ffcee
commit
384736e955
13
window.c
13
window.c
@ -935,10 +935,13 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv,
|
|||||||
proc_clear_signals(server_proc, 1);
|
proc_clear_signals(server_proc, 1);
|
||||||
sigprocmask(SIG_SETMASK, &oldset, NULL);
|
sigprocmask(SIG_SETMASK, &oldset, NULL);
|
||||||
|
|
||||||
if (chdir(wp->cwd) != 0) {
|
cwd = NULL;
|
||||||
if ((home = find_home()) == NULL || chdir(home) != 0)
|
if (chdir(wp->cwd) == 0)
|
||||||
chdir("/");
|
cwd = wp->cwd;
|
||||||
}
|
else if ((home = find_home()) != NULL && chdir(home) == 0)
|
||||||
|
cwd = home;
|
||||||
|
else
|
||||||
|
chdir("/");
|
||||||
|
|
||||||
if (tcgetattr(STDIN_FILENO, &tio2) != 0)
|
if (tcgetattr(STDIN_FILENO, &tio2) != 0)
|
||||||
fatal("tcgetattr failed");
|
fatal("tcgetattr failed");
|
||||||
@ -953,6 +956,8 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv,
|
|||||||
|
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
environ_set(env, "PATH", "%s", path);
|
environ_set(env, "PATH", "%s", path);
|
||||||
|
if (cwd != NULL)
|
||||||
|
environ_set(env, "PWD", "%s", cwd);
|
||||||
environ_set(env, "TMUX_PANE", "%%%u", wp->id);
|
environ_set(env, "TMUX_PANE", "%%%u", wp->id);
|
||||||
environ_push(env);
|
environ_push(env);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user