This commit is contained in:
Matt Green 2016-11-09 17:25:52 -05:00
parent 707fa2e952
commit 2d2a8cb079
3 changed files with 13 additions and 14 deletions

View File

@ -6,7 +6,8 @@ lazy_static! {
#[cfg(unix)]
pub fn install_handler<F>(handler: F)
where F: Fn() + 'static + Send + Sync {
where F: Fn() + 'static + Send + Sync
{
use std::thread;
use nix::sys::signal::*;
@ -29,7 +30,9 @@ pub fn install_handler<F>(handler: F)
// Restore default behavior for received signal and unmask it
unsafe {
let _ = sigaction(sig, &SigAction::new(SigHandler::SigDfl, SaFlags::empty(), SigSet::empty()));
let _ =
sigaction(sig,
&SigAction::new(SigHandler::SigDfl, SaFlags::empty(), SigSet::empty()));
}
let mut new_mask = SigSet::empty();
@ -43,7 +46,8 @@ pub fn install_handler<F>(handler: F)
#[cfg(windows)]
pub fn install_handler<F>(handler: F)
where F: Fn() + 'static + Send + Sync {
where F: Fn() + 'static + Send + Sync
{
use kernel32::SetConsoleCtrlHandler;
use winapi::{BOOL, DWORD, FALSE, TRUE};
@ -68,7 +72,8 @@ fn invoke() {
}
fn set_handler<F>(handler: F)
where F: Fn() + 'static + Send + Sync {
where F: Fn() + 'static + Send + Sync
{
*CLEANUP.lock().unwrap() = Some(Box::new(handler));
}

View File

@ -36,7 +36,7 @@ use std::time::Duration;
use std::path::{Path, PathBuf};
use notification_filter::NotificationFilter;
use process::{Process};
use process::Process;
use watcher::{Event, Watcher};
fn find_gitignore(path: &Path) -> Option<PathBuf> {
@ -133,7 +133,7 @@ fn main() {
// Start child process initially, if necessary
if args.run_initially {
if args.clear_screen {
if args.clear_screen {
cli::clear_screen();
}

View File

@ -31,11 +31,7 @@ mod imp {
command.before_exec(|| setpgid(0, 0).map_err(io::Error::from))
.spawn()
.and_then(|p| {
Ok(Process {
pid: p.id() as i32,
})
})
.and_then(|p| Ok(Process { pid: p.id() as i32 }))
}
pub fn kill(&self) {
@ -115,9 +111,7 @@ mod imp {
panic!("failed to add to job object: {}", last_err());
}
Ok(Process {
job: job,
})
Ok(Process { job: job })
})
}