| Crates.io | vorarbeiter |
| lib.rs | vorarbeiter |
| version | 0.1.0 |
| created_at | 2020-12-06 11:47:24.753424+00 |
| updated_at | 2020-12-06 11:47:24.753424+00 |
| description | A small process supervisor that shutdowns child processes |
| homepage | |
| repository | https://github.com/mbr/vorarbeiter-rs |
| max_upload_size | |
| id | 320106 |
| size | 6,311 |
vorarbeiter::Supervisor shuts down processes it owns on Drop by sending a SIGTERM first, followed by a SIGKILL:
use std::process;
// The default kill timeout is 10 seconds, which is fine here.
let mut supervisor = vorarbeiter::Supervisor::default();
// Spawns three new child processes and adds them to the supervisor.
for _ in 0..3 {
let child = process::Command::new("my-subcommand").spawn().unwrap();
supervisor.add_child(child);
}
// Terminate all child processes.
drop(supervisor);
See the documentation for details.