windows: always initialize uv_process_t
The unix implementation of uv_spawn always starts out with a uv__handle_init, but the windows implementation sometimes bails out early before calling uv__handle_init. This means that uv_close on a failed uv_spawn will always succeed on unix but sometimes fail on windows. This commit lifts the initialization of the uv_process_t above all of the error checking to ensure that uv_close will always work when uv_spawn returns an error.
This commit is contained in:
parent
8692bbc254
commit
6f62d62c90
@ -811,6 +811,9 @@ int uv_spawn(uv_loop_t* loop,
|
||||
PROCESS_INFORMATION info;
|
||||
DWORD process_flags;
|
||||
|
||||
uv_process_init(loop, process);
|
||||
process->exit_cb = options->exit_cb;
|
||||
|
||||
if (options->flags & (UV_PROCESS_SETGID | UV_PROCESS_SETUID)) {
|
||||
return UV_ENOTSUP;
|
||||
}
|
||||
@ -827,9 +830,6 @@ int uv_spawn(uv_loop_t* loop,
|
||||
UV_PROCESS_WINDOWS_HIDE |
|
||||
UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS)));
|
||||
|
||||
uv_process_init(loop, process);
|
||||
process->exit_cb = options->exit_cb;
|
||||
|
||||
err = uv_utf8_to_utf16_alloc(options->file, &application);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user