pub struct Process { /* private fields */ }Implementations§
Source§impl Process
impl Process
pub fn new() -> Self
Sourcepub fn with_executable(self, executable: impl ToString) -> Self
pub fn with_executable(self, executable: impl ToString) -> Self
Sets the executable to run.
Sourcepub fn with_args(self, args: impl IntoIterator<Item = impl ToString>) -> Self
pub fn with_args(self, args: impl IntoIterator<Item = impl ToString>) -> Self
Sets the arguments to pass to the executable.
Sourcepub fn with_cancel_timeout(self, t: impl Into<Option<Duration>>) -> Self
pub fn with_cancel_timeout(self, t: impl Into<Option<Duration>>) -> Self
Sets the cancellation timeout before forcing the process to exit.
Sourcepub fn with_env(
self,
env: impl IntoIterator<Item = (impl ToString, impl ToString)>,
) -> Self
pub fn with_env( self, env: impl IntoIterator<Item = (impl ToString, impl ToString)>, ) -> Self
Sets the environment variables to pass to the executable.
Sourcepub fn with_on_stdout<F, A>(self, on_stdout: F) -> Selfwhere
F: Fn(ProcessManager, ProcessKey, String) -> A + Unpin + Send + Sync + 'static,
A: Future<Output = ()> + Send + 'static,
pub fn with_on_stdout<F, A>(self, on_stdout: F) -> Selfwhere
F: Fn(ProcessManager, ProcessKey, String) -> A + Unpin + Send + Sync + 'static,
A: Future<Output = ()> + Send + 'static,
Sets the callback to run when the process writes to stdout.
Sourcepub fn with_on_stderr<F, A>(self, on_stderr: F) -> Selfwhere
F: Fn(ProcessManager, ProcessKey, String) -> A + Unpin + Send + Sync + 'static,
A: Future<Output = ()> + Send + 'static,
pub fn with_on_stderr<F, A>(self, on_stderr: F) -> Selfwhere
F: Fn(ProcessManager, ProcessKey, String) -> A + Unpin + Send + Sync + 'static,
A: Future<Output = ()> + Send + 'static,
Sets the callback to run when the process writes to stderr.
Sourcepub fn with_fds<F>(self, fds: F) -> Self
pub fn with_fds<F>(self, fds: F) -> Self
Shares Fds with the child process Closure produces a vector of Fd to share with the child process
Sourcepub fn with_on_start<F, A>(self, on_start: F) -> Selfwhere
F: Fn(ProcessManager, ProcessKey, bool) -> A + Unpin + Send + Sync + 'static,
A: Future<Output = ()> + Send + 'static,
pub fn with_on_start<F, A>(self, on_start: F) -> Selfwhere
F: Fn(ProcessManager, ProcessKey, bool) -> A + Unpin + Send + Sync + 'static,
A: Future<Output = ()> + Send + 'static,
This is called when the process is started.
It passes a single argument: a bool indicating whether the process was restarted or if it was started for the first time.
Sourcepub fn with_on_exit<F, A>(self, on_exit: F) -> Self
pub fn with_on_exit<F, A>(self, on_exit: F) -> Self
Sets the callback to run when the process exits. This is called after the process exits, or before it restarts.
It passes two arguments: an optional exit code, and a bool indicating whether the process is going to be restarted or not.