Skip to content

49nord/process_guard-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

process_guard

A process guard takes ownership of a process::Child and gently or forcefully kills it upon, prevent the process from running on. Example:

use process_guard::ProcessGuard;
use std::process;

fn insomnia() {
   let cmd = process::Command::new("sleep").arg("120");
   let pg = ProcessGuard::spawn(cmd);

   // a two-minute sleep process has been started, which will be killed as soon as this
   // function returns
}

OS support

The crate is currently only developed with Linux in mind. Windows/BSD/Mac OS X ports are appreciated

About

Guard a process by terminating it on drop

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages