MCPcopy Create free account
hub / github.com/arun11299/cpp-subprocess / output

Class output

cpp-subprocess/subprocess.hpp:946–966  ·  view source on GitHub ↗

! * Option to specify the output channel for the child * process. It can be: * 1. An already open file descriptor. * 2. A file name. * 3. IOTYPE. Usually a PIPE. * * Eg: output{PIPE} * OR output{"output.txt"} */

Source from the content-addressed store, hash-verified

944 * OR output{"output.txt"}
945 */
946struct output
947{
948 explicit output(int fd): wr_ch_(fd) {}
949
950 explicit output (FILE* fp):output(subprocess_fileno(fp)) { assert(fp); }
951
952 explicit output(const char* filename) {
953 int fd = subprocess_open(filename, O_APPEND | O_CREAT | O_RDWR, 0640);
954 if (fd == -1) throw OSError("File not found: ", errno);
955 wr_ch_ = fd;
956 }
957 explicit output(IOTYPE typ) {
958 assert (typ == PIPE && "STDOUT/STDERR not allowed");
959#ifndef __USING_WINDOWS__
960 std::tie(rd_ch_, wr_ch_) = util::pipe_cloexec();
961#endif
962 }
963
964 int rd_ch_ = -1;
965 int wr_ch_ = -1;
966};
967
968
969/*!

Callers 1

setup_comm_channelsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected