MCPcopy Create free account
hub / github.com/AGWA/git-crypt / stdin_pipe

Method stdin_pipe

coprocess-win32.cpp:138–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138std::ostream* Coprocess::stdin_pipe ()
139{
140 if (!stdin_pipe_ostream) {
141 SECURITY_ATTRIBUTES sec_attr;
142
143 // Set the bInheritHandle flag so pipe handles are inherited.
144 sec_attr.nLength = sizeof(SECURITY_ATTRIBUTES);
145 sec_attr.bInheritHandle = TRUE;
146 sec_attr.lpSecurityDescriptor = nullptr;
147
148 // Create a pipe for the child process's STDIN.
149 if (!CreatePipe(&stdin_pipe_reader, &stdin_pipe_writer, &sec_attr, 0)) {
150 throw System_error("CreatePipe", "", GetLastError());
151 }
152
153 // Ensure the write handle to the pipe for STDIN is not inherited.
154 if (!SetHandleInformation(stdin_pipe_writer, HANDLE_FLAG_INHERIT, 0)) {
155 throw System_error("SetHandleInformation", "", GetLastError());
156 }
157
158 stdin_pipe_ostream = new ofhstream(this, write_stdin);
159 }
160 return stdin_pipe_ostream;
161}
162
163void Coprocess::close_stdin ()
164{

Callers

nothing calls this directly

Calls 1

System_errorClass · 0.85

Tested by

no test coverage detected