#include <posix_child.hpp>
Public Member Functions | |
postream & | get_input (int desc) const |
pistream & | get_output (int desc) const |
posix_child (id_type id, detail::info_map &infoin, detail::info_map &infoout) |
The posix_child class implements the Child concept in a POSIX operating system.
A POSIX child differs from a regular child (represented by a child object) in that it supports more than three communication channels with its parent. These channels are identified by regular file descriptors (integers).
This class is built on top of the generic child so as to allow its trivial adoption. When a program is changed to use the POSIX-specific context (posix_context), it will most certainly need to migrate its use of the child class to posix_child. Doing so is only a matter of redefining the appropriate object and later using the required extra features: there should be no need to modify the existing code (e.g. method calls) in any other way.
boost::process::posix_child::posix_child | ( | id_type | id, | |
detail::info_map & | infoin, | |||
detail::info_map & | infoout | |||
) | [inline] |
Constructs a new POSIX child object representing a just spawned child process.
Creates a new child object that represents the just spawned process id.
The infoin and infoout maps contain the pipes used to handle the redirections of the child process; at the moment, no other stream_info types are supported. If the launcher was asked to redirect any of the three standard flows, their pipes must be present in these maps.
postream& boost::process::posix_child::get_input | ( | int | desc | ) | const [inline] |
Gets a reference to the child's input stream desc.
Returns a reference to a postream object that represents one of the multiple input communication channels with the child process. The channel is identified by desc as seen from the child's point of view. The parent can use the returned stream to send data to the child.
Giving this function the STDIN_FILENO constant (defined in unistd.h) is a synonym for the get_stdin() call inherited from child.
pistream& boost::process::posix_child::get_output | ( | int | desc | ) | const [inline] |
Gets a reference to the child's output stream desc.
Returns a reference to a pistream object that represents one of the multiple output communication channels with the child process. The channel is identified by desc as seen from the child's point of view. The parent can use the returned stream to retrieve data from the child.
Giving this function the STDOUT_FILENO or STDERR_FILENO constants (both defined in unistd.h) are synonyms for the get_stdout() and get_stderr() calls inherited from child, respectively.