-
Notifications
You must be signed in to change notification settings - Fork 7
process std_stream
nes::process::stdin_stream, nes::process::stdout_stream, nes::process::stderr_stream
(1) pipe_ostream& stdin_stream() noexcept;
(2) pipe_istream& stdout_stream() noexcept;
(3) pipe_istream& stderr_stream() noexcept;
These functions returns a pipe on the standard streams of the process (stdin, stdout, stderr). These functions are defined only if the file "pipe.hpp"
is present.
The references on the pipes are not invalidated if the process object is moved, i.e. the pipes have static addresses.
They share their lifetime with the process object, but you can move them and then become responsible of their lifetimes.
These pipes have the same behaviour as the ones defined in <nes/pipe.hpp>
, so it can turn into deadlocks if not used correctly.
If you close/destroy a grabbed stream, the child can run into an error if it use the other end of the closed/destroyed stream.
Also, you should not call join
before all grabbed streams become "end-of-file" because it can deadlock both processes if the child is still using them.
The pipes stay valid after a call to detach
and still have all properties listed above, so you must keep them alive as long as the child is running.
These pipes will become "end-of-file" after a call to join
, or a successful call to kill
because the other end will be closed.
- Get the pipe linked to the process standard input.
- Get the pipe linked to the process standard output.
- Get the pipe linked to the process standard error.
None.
- Returns a reference on a pipe that is the write end of the process standard input.
- Returns a reference on a pipe that is the read end of the process standard output.
- Returns a reference on a pipe that is the read end of the process standard error.
The file "pipe.hpp"
must be present.
-
nes::process_options::grab_stdin
must has been specified in the process creation. -
nes::process_options::grab_stdout
must has been specified in the process creation. -
nes::process_options::grab_stderr
must has been specified in the process creation.
Does not throw.