Skip to content
Browse files

unix: do not set environ unless one is provided

Currently, `uv_spawn` will set `environ` to the value of `options.env`, even if
`options.env` is `NULL`.  This results in child processes for whom `environ ==
NULL`, which can cause a variety of unexpected issues.
  • Loading branch information...
1 parent 97c527a commit 5b9b3a7b540bd4edbecc9eb70f2f1b80b9045dc7 @AvianFlu committed
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/unix/process.c
View
4 src/unix/process.c
@@ -340,7 +340,9 @@ static void uv__process_child_init(uv_process_options_t options,
_exit(127);
}
- environ = options.env;
+ if (options.env) {
+ environ = options.env;
+ }
execvp(options.file, options.args);
uv__write_int(error_fd, errno);

0 comments on commit 5b9b3a7

Please sign in to comment.
Something went wrong with that request. Please try again.