Set working directory for run-shell and if-shell.

This commit is contained in:
nicm
2015-04-24 22:19:36 +00:00
parent 5a2d0533a8
commit 583b4ab72b
6 changed files with 31 additions and 10 deletions

5
job.c
View File

@ -41,7 +41,7 @@ struct joblist all_jobs = LIST_HEAD_INITIALIZER(all_jobs);
/* Start a job running, if it isn't already. */
struct job *
job_run(const char *cmd, struct session *s,
job_run(const char *cmd, struct session *s, int cwd,
void (*callbackfn)(struct job *), void (*freefn)(void *), void *data)
{
struct job *job;
@ -67,6 +67,9 @@ job_run(const char *cmd, struct session *s,
case 0: /* child */
clear_signals(1);
if (cwd != -1 && fchdir(cwd) != 0)
chdir("/");
environ_push(&env);
environ_free(&env);