Opens a pair of file handles. On success, the first handle returned receives the 'read' handle of the pipe, while the second receives the 'write' handle. The pipe handles can then be passed to a child process, as shown in [1]. [1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx
| 50 | // |
| 51 | // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx |
| 52 | Subprocess::IO Subprocess::PIPE() |
| 53 | { |
| 54 | return Subprocess::IO( |
| 55 | []() -> Try<InputFileDescriptors> { |
| 56 | // Create STDIN pipe and set the 'read' component to be not overlapped, |
| 57 | // because we're sending it to the child process. |
| 58 | const Try<array<int_fd, 2>> pipefd = os::pipe(false, true); |
| 59 | if (pipefd.isError()) { |
| 60 | return Error(pipefd.error()); |
| 61 | } |
| 62 | |
| 63 | return InputFileDescriptors{pipefd.get()[0], pipefd.get()[1]}; |
| 64 | }, |
| 65 | []() -> Try<OutputFileDescriptors> { |
| 66 | // Create STDOUT pipe and set the 'write' component to be not |
| 67 | // overlapped, because we're sending it to the child process. |
| 68 | const Try<array<int_fd, 2>> pipefd = os::pipe(true, false); |
| 69 | if (pipefd.isError()) { |
| 70 | return Error(pipefd.error()); |
| 71 | } |
| 72 | |
| 73 | return OutputFileDescriptors{pipefd.get()[0], pipefd.get()[1]}; |
| 74 | }); |
| 75 | } |
| 76 | |
| 77 | |
| 78 | Subprocess::IO Subprocess::PATH(const string& path) |