--- src/job.c.orig 2018-08-05 01:20:58.000000000 +0200 +++ src/job.c 2018-08-06 09:08:39.075299620 +0200 @@ -1412,7 +1412,7 @@ { /* Fork the child process. */ - char **parent_environ; + /*char **parent_environ;*/ run_local: block_sigs (); @@ -1425,14 +1425,15 @@ #else - parent_environ = environ; + /* posix_spawn() will not clobber the environment, so we don't need this */ + /*parent_environ = environ;*/ jobserver_pre_child (flags & COMMANDS_RECURSE); child->pid = child_execute_job (&child->output, child->good_stdin, argv, child->environment); - environ = parent_environ; /* Restore value child may have clobbered. */ + /*environ = parent_environ;*/ /* Restore value child may have clobbered. */ jobserver_post_child (flags & COMMANDS_RECURSE); #endif /* !VMS */ } @@ -2449,8 +2450,7 @@ # else /* Run the program. */ - environ = envp; - execvp (argv[0], argv); + execvpe (argv[0], argv, envp); # endif /* !__EMX__ */