pub struct RunningProcess {
pub process: Process,
/* private fields */
}Expand description
A process that is currently running and being monitored.
§Fork Safety
This handle contains both a PID and owned file descriptors for process I/O.
Upon fork, the descriptors are inherited. Standard O_CLOEXEC behavior
applies after exec.
Fields§
§process: ProcessHandle to the process.
Implementations§
Source§impl RunningProcess
impl RunningProcess
Sourcepub fn register_with_reactor(
&mut self,
reactor: &mut Reactor,
) -> Result<(), CoreError>
pub fn register_with_reactor( &mut self, reactor: &mut Reactor, ) -> Result<(), CoreError>
Register active stdio pipe descriptors with a reactor.
Call this once after spawn_start when the process was started with
captured output or stdin data. The assigned tokens are kept internally
and later matched by Self::handle_reactor_event.
Sourcepub fn handle_reactor_event(
&mut self,
reactor: &mut Reactor,
event: &Event,
) -> Result<(), CoreError>
pub fn handle_reactor_event( &mut self, reactor: &mut Reactor, event: &Event, ) -> Result<(), CoreError>
Apply one reactor readiness event to this process’ stdio drain state.
Events for unrelated tokens are ignored. Callers remain responsible for
waiting on Self::process and driving the reactor until Self::io_done
returns true.
Sourcepub fn io_done(&self) -> bool
pub fn io_done(&self) -> bool
Return whether all managed stdio pipes have been drained or closed.
Sourcepub fn stdout_paused(&self) -> bool
pub fn stdout_paused(&self) -> bool
Return whether the stdout stream is paused on a full sink queue.
Sourcepub fn stderr_paused(&self) -> bool
pub fn stderr_paused(&self) -> bool
Return whether the stderr stream is paused on a full sink queue.
Sourcepub fn resume_stdout(
&mut self,
reactor: &mut Reactor,
) -> Result<bool, CoreError>
pub fn resume_stdout( &mut self, reactor: &mut Reactor, ) -> Result<bool, CoreError>
Re-deliver the held stdout chunk (if any) and re-register the fd when
the sink has room again. Returns true when the stream is resumed.
Sourcepub fn resume_stderr(
&mut self,
reactor: &mut Reactor,
) -> Result<bool, CoreError>
pub fn resume_stderr( &mut self, reactor: &mut Reactor, ) -> Result<bool, CoreError>
Re-deliver the held stderr chunk (if any) and re-register the fd when
the sink has room again. Returns true when the stream is resumed.
Sourcepub fn into_output_parts(self) -> (Vec<u8>, Vec<u8>)
pub fn into_output_parts(self) -> (Vec<u8>, Vec<u8>)
Consume the running process handle and return captured stdout/stderr buffers.
Sourcepub fn resize_pty(&self, rows: u16, cols: u16) -> Result<(), CoreError>
pub fn resize_pty(&self, rows: u16, cols: u16) -> Result<(), CoreError>
Apply a new terminal window size to a pty-spawned child.
Only valid for a SpawnOptionsBuilder::pty spawn with an active
stdout stream; callers typically follow this with a SIGWINCH to the
child (or its foreground group) so the program can re-read the size.
§Errors
EINVAL: The spawn was not a pty spawn, orrows/colsis zero.ENOTTY: The pty master is unexpectedly not a terminal.
Sourcepub fn write_input(&self, bytes: &[u8]) -> Result<usize, CoreError>
pub fn write_input(&self, bytes: &[u8]) -> Result<usize, CoreError>
Write bytes to a pty-spawned child’s stdin (the master end).
Only valid for a SpawnOptionsBuilder::pty spawn with an active
stdout stream; the write is accepted by the tty line discipline and
delivered to the child as its stdin.
§Errors
EINVAL: The spawn was not a pty spawn, or the stream is already closed.EIO: All slave holders have closed (master-side write failure).ETIMEDOUT: The child did not drain its input within the bound.