| /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
| file Copyright.txt or https://cmake.org/licensing for details. */ |
| #if defined(_WIN32) && !defined(__CYGWIN__) |
| SECURITY_ATTRIBUTES attr; |
| attr.nLength = sizeof(attr); |
| attr.lpSecurityDescriptor = nullptr; |
| attr.bInheritHandle = FALSE; |
| if (!CreatePipe(&readh, &writeh, &attr, 0)) |
| return uv_translate_sys_error(GetLastError()); |
| fds[0] = _open_osfhandle((intptr_t)readh, 0); |
| fds[1] = _open_osfhandle((intptr_t)writeh, 0); |
| if (fds[0] == -1 || fds[1] == -1) { |
| return uv_translate_sys_error(GetLastError()); |
| return uv_translate_sys_error(errno); |
| if (fcntl(fds[0], F_SETFD, FD_CLOEXEC) == -1 || |
| fcntl(fds[1], F_SETFD, FD_CLOEXEC) == -1) { |
| return uv_translate_sys_error(errno); |