Struct workflow_node::process::Process
source · pub struct Process { /* private fields */ }Expand description
The Process class facilitating execution of a Child Process in Node.js or NWJS
environments. This wrapper runs the child process as a daemon, restarting it if
it fails. The process provides stdout and stderr output as channel Receiver
channels, allowing for a passive capture of the process console output.
Implementations§
source§impl Process
impl Process
pub fn new_once(path: &str) -> Process
pub async fn version(path: &str) -> Result<Version>
pub fn is_running(&self) -> bool
pub fn mute(&self, mute: bool) -> Result<()>
pub fn toggle_mute(&self) -> Result<bool>
pub fn uptime(&self) -> Option<Duration>
pub fn replace_argv(&self, argv: Vec<String>)
sourcepub fn run(&self) -> Result<()>
pub fn run(&self) -> Result<()>
Run the process in the background. Spawns an async task that monitors the process, capturing its output and restarting the process if it exits prematurely.
sourcepub fn restart(&self) -> Result<()>
pub fn restart(&self) -> Result<()>
Issue a SIGTERM signal causing the process to exit. The process
will be restarted by the monitoring task.
sourcepub fn stop(&self) -> Result<()>
pub fn stop(&self) -> Result<()>
Stop the process by disabling auto-restart and issuing
a SIGTERM signal. Returns Ok(()) if the process
is not running.
sourcepub async fn join(&self) -> Result<()>
pub async fn join(&self) -> Result<()>
Join the process like you would a thread - this async function blocks until the process exits.
sourcepub async fn stop_and_join(&self) -> Result<()>
pub async fn stop_and_join(&self) -> Result<()>
Stop the process and block until it exits.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Process
impl RefUnwindSafe for Process
impl Unpin for Process
impl UnwindSafe for Process
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)