void uv_pipe_open(uv_pipe_t* pipe, uv_file file) { HANDLE os_handle = (HANDLE)_get_osfhandle(file); if (os_handle == INVALID_HANDLE_VALUE || uv_set_pipe_handle(pipe->loop, pipe, os_handle) == -1) { return; } uv_pipe_connection_init(pipe); pipe->handle = os_handle; if (pipe->ipc) { assert(!(pipe->flags & UV_HANDLE_NON_OVERLAPPED_PIPE)); pipe->ipc_pid = uv_parent_pid(); assert(pipe->ipc_pid != -1); } }
int uv_pipe_open(uv_pipe_t* pipe, uv_file file) { HANDLE os_handle = (HANDLE)_get_osfhandle(file); if (os_handle == INVALID_HANDLE_VALUE || uv_set_pipe_handle(pipe->loop, pipe, os_handle, 0) == -1) { uv__set_sys_error(pipe->loop, WSAEINVAL); return -1; } uv_pipe_connection_init(pipe); pipe->handle = os_handle; pipe->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; if (pipe->ipc) { assert(!(pipe->flags & UV_HANDLE_NON_OVERLAPPED_PIPE)); pipe->ipc_pid = uv_parent_pid(); assert(pipe->ipc_pid != -1); } return 0; }