windows/uv_spawn: ignore errors when duplicating fd 0-2 fails

Hopefully this fixes joyent/node#3779.
This commit is contained in:
Bert Belder 2012-07-31 19:38:43 +02:00
parent ed2bc23346
commit 9d71d1cab5

View File

@ -330,6 +330,13 @@ int uv__stdio_create(uv_loop_t* loop, uv_process_options_t* options,
/* Make an inheritable duplicate of the handle. */
if (uv__duplicate_fd(loop, fdopt.data.fd, &child_handle) < 0) {
/* If fdopt.data.fd is not valid and fd fd <= 2, then ignore the */
/* error. */
if (fdopt.data.fd <= 2 && loop->last_err.code == UV_EBADF) {
CHILD_STDIO_CRT_FLAGS(buffer, i) = 0;
CHILD_STDIO_HANDLE(buffer, i) = NULL;
break;
}
goto error;
}