MCPcopy Create free account
hub / github.com/3rdparty/libprocess / PIPE

Method PIPE

src/windows/subprocess.cpp:52–75  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

50//
51// [1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx
52Subprocess::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
78Subprocess::IO Subprocess::PATH(const string& path)

Callers

nothing calls this directly

Calls 2

IOClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected