aboutsummaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
Diffstat (limited to 'job.c')
-rw-r--r--job.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/job.c b/job.c
index 3624c679..d2d9adbf 100644
--- a/job.c
+++ b/job.c
@@ -69,7 +69,7 @@ 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 session *s,
+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)
{
@@ -87,6 +87,8 @@ job_run(const char *cmd, int argc, char **argv, struct session *s,
* if-shell to decide on default-terminal based on outside TERM.
*/
env = environ_for_session(s, !cfg_finished);
+ if (e != NULL)
+ environ_copy(e, env);
sigfillset(&set);
sigprocmask(SIG_BLOCK, &set, &oldset);
@@ -137,7 +139,7 @@ job_run(const char *cmd, int argc, char **argv, struct session *s,
close(out[1]);
close(out[0]);
- nullfd = open(_PATH_DEVNULL, O_RDWR, 0);
+ nullfd = open(_PATH_DEVNULL, O_RDWR);
if (nullfd == -1)
fatal("open failed");
if (dup2(nullfd, STDERR_FILENO) == -1)