subprocess::odescriptor class

Adds write ability to descriptor.

Additionally, the class is marked closable. All output descriptors inherit from this class.

Base classes

class descriptor virtual
Abstracts file descriptors.

Derived classes

class ofile_descriptor virtual
Always opens the file in write-mode.
class opipe_descriptor
A descriptor wrapping the output end of a posix OS pipe.

Constructors, destructors, conversion operators

descriptor() defaulted
descriptor(int fd) explicit
descriptor(const descriptor&) defaulted
descriptor(descriptor&&) defaulted noexcept

Public functions

void write(std::string& input) virtual
Writes a given string to fd.
void close() override
Tear down the descriptor.
auto closable() const -> bool override
Marks whether the subprocess should close the FD.

Function documentation

void subprocess::odescriptor::write(std::string& input) virtual

Writes a given string to fd.

Parameters
input

void subprocess::odescriptor::close() override

Tear down the descriptor.

close() is called by subprocess::execute() after the process is spawned, but before waiting. This should ideally be the place where you should tear down the constructs that were required for process I/O.

bool subprocess::odescriptor::closable() const override

Marks whether the subprocess should close the FD.

Returns true The subprocess should close the FD