struct Child! { ... }
A program Command!::spawn started, running until it is waited for, with this process's end of each of its streams that is a pipe. Waiting reaps it, so a child is waited for once; one left unwaited would stay a zombie until this process ends. Until then its process id is its own, so kill and signal reach this child and no other.
Methods
method idsource
fn id(&self) -> i64 { ... }
The child's process id.
method take_stdinsource
fn take_stdin(&self) -> Option[File!] { ... }
The write end of the child's standard input, when it is a pipe and was not taken before. Closing it is the end of the child's input.
method take_stdoutsource
fn take_stdout(&self) -> Option[File!] { ... }
The read end of the child's standard output, when it is a pipe and was not taken before.
method take_stderrsource
fn take_stderr(&self) -> Option[File!] { ... }
The read end of the child's standard error, when it is a pipe and was not taken before.
method killsource
fn kill(&self) -> Result[(), Error] { ... }
Ends the child: sends it SIGKILL, which it cannot catch. It still has to be waited for (wait), which reports Exit::Signal with SIGKILL's number unless it ended first. The error is what kill(2) reports.
method signalsource
fn signal(&self, signal: i32) -> Result[(), Error] { ... }
Sends the child the signal numbered signal (kill(2)), such as 15, SIGTERM, which asks it to end. The error is what kill(2) reports: EINVAL for a number that is no signal.
method waitsource
fn wait(self) -> Result[Exit, Error] { ... }
Waits for the child to end, again when a signal interrupts the wait. The ends of its pipes this child still holds are closed first, its standard input's among them, so a child reading it sees its end. The error is what waitpid reports.
method try_waitsource
fn try_wait(self) -> Result[Polled!, Error] { ... }
Whether the child has ended, without waiting: the child back while it runs, else how it ended, with the ends of its pipes it held closed. The error is what waitpid reports.
method wait_with_outputsource
fn wait_with_output(self) -> Result[Captured!, Error] { ... }
Reads the child's standard output and error to their ends, then waits for it: how it ended and what it wrote. Both are read as they come (poll), so a child that fills one pipe while this process waits on the other does not stall it. A stream that is not a pipe, or whose end was taken, gives an empty buffer. Standard input's end, when this child holds it, is closed first. A read error is returned after the child has been waited for.