I've wrote a small process manager in Rust that I've been interested in 
migrating to Nim due to the languages ease of use. Does anyone know if the std 
provides the ability to spawn new processes and monitor their current state?

Example:
    
    
        loop {
            for (agent, process) in &mut agents {
                match process.try_wait() {
                    Ok(Some(status)) => {
                        println!("Exited with status {}", status);
                        *process = Command::new("python")
                            .arg("worker.py")
                            .arg(name.as_ref())
                            .spawn()
                            .expect("worker failed to start");
                    },
                    Ok(None) => println!("timeout, process is still alive: {}", 
agent),
                    Err(e) => println!("Error waiting: {}", e),
                };
            }
        }
    
    
    Run

Reply via email to