zos: use execvpe() to set environ explictly

On z/OS, `execvp()` does not set the environment for child process from
`environ` when ran in ASCII mode. Instead, `execvpe()` provided by
ZOSLIB must be used to set the environment explicitly.

PR-URL: https://github.com/libuv/libuv/pull/3060
Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
Shuowang (Wayne) Zhang 2020-09-02 11:31:51 -04:00 committed by Richard Lau
parent 880cdc38b8
commit f6adf960ce
No known key found for this signature in database
GPG Key ID: C43CEC45C17AB93C

View File

@ -44,6 +44,10 @@ extern char **environ;
# include <grp.h> # include <grp.h>
#endif #endif
#if defined(__MVS__)
# include "zos-base.h"
#endif
static void uv__chld(uv_signal_t* handle, int signum) { static void uv__chld(uv_signal_t* handle, int signum) {
uv_process_t* process; uv_process_t* process;
@ -336,7 +340,11 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127); _exit(127);
} }
#ifdef __MVS__
execvpe(options->file, options->args, environ);
#else
execvp(options->file, options->args); execvp(options->file, options->args);
#endif
uv__write_int(error_fd, UV__ERR(errno)); uv__write_int(error_fd, UV__ERR(errno));
_exit(127); _exit(127);
} }