mirror of
https://github.com/tmux/tmux.git
synced 2025-09-05 19:08:16 +00:00
Set PWD for jobs as well as panes.
This commit is contained in:
10
job.c
10
job.c
@@ -141,9 +141,13 @@ job_run(const char *cmd, int argc, char **argv, struct environ *e,
|
||||
proc_clear_signals(server_proc, 1);
|
||||
sigprocmask(SIG_SETMASK, &oldset, NULL);
|
||||
|
||||
if ((cwd == NULL || chdir(cwd) != 0) &&
|
||||
((home = find_home()) == NULL || chdir(home) != 0) &&
|
||||
chdir("/") != 0)
|
||||
if (chdir(cwd) == 0)
|
||||
environ_set(env, "PWD", 0, "%s", cwd);
|
||||
else if ((home = find_home()) != NULL && chdir(home) == 0)
|
||||
environ_set(env, "PWD", 0, "%s", home);
|
||||
else if (chdir("/") == 0)
|
||||
environ_set(env, "PWD", 0, "/");
|
||||
else
|
||||
fatal("chdir failed");
|
||||
|
||||
environ_push(env);
|
||||
|
Reference in New Issue
Block a user