Avoid using execvpe function.

This commit is contained in:
Calvin Rose 2023-10-08 21:33:15 -05:00
parent 741a5036e8
commit cb25a2ecd6
1 changed files with 5 additions and 2 deletions

View File

@ -1247,11 +1247,14 @@ static Janet os_execute_impl(int32_t argc, Janet *argv, JanetExecuteMode mode) {
janet_panic("not supported on windows");
#else
int status;
if (!use_environ) {
environ = envp;
}
do {
if (janet_flag_at(flags, 1)) {
status = execvpe(cargv[0], cargv, use_environ ? environ : envp);
status = execvp(cargv[0], cargv);
} else {
status = execve(cargv[0], cargv, use_environ ? environ : envp);
status = execv(cargv[0], cargv);
}
} while (status == -1 && errno == EINTR);
janet_panicf("%p: %s", cargv[0], strerror(errno ? errno : ENOENT));