| 45 | |
| 46 | |
| 47 | Subprocess::IO Subprocess::PIPE() |
| 48 | { |
| 49 | return Subprocess::IO( |
| 50 | []() -> Try<InputFileDescriptors> { |
| 51 | Try<array<int, 2>> pipefd = os::pipe(); |
| 52 | if (pipefd.isError()) { |
| 53 | return Error(pipefd.error()); |
| 54 | } |
| 55 | |
| 56 | InputFileDescriptors fds; |
| 57 | fds.read = pipefd->at(0); |
| 58 | fds.write = pipefd->at(1); |
| 59 | return fds; |
| 60 | }, |
| 61 | []() -> Try<OutputFileDescriptors> { |
| 62 | Try<array<int, 2>> pipefd = os::pipe(); |
| 63 | if (pipefd.isError()) { |
| 64 | return Error(pipefd.error()); |
| 65 | } |
| 66 | |
| 67 | OutputFileDescriptors fds; |
| 68 | fds.read = pipefd->at(0); |
| 69 | fds.write = pipefd->at(1); |
| 70 | return fds; |
| 71 | }); |
| 72 | } |
| 73 | |
| 74 | |
| 75 | Subprocess::IO Subprocess::PATH(const string& path) |