Try to gracefully terminal child process before using SIGKILL (#4890)

This commit is contained in:
Michael Vines
2019-07-01 14:08:30 -07:00
committed by GitHub
parent 38b44f2496
commit 0999225794
5 changed files with 74 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
use crate::config::Config;
use crate::stop_process::stop_process;
use crate::update_manifest::{SignedUpdateManifest, UpdateManifest};
use chrono::{Local, TimeZone};
use console::{style, Emoji};
@@ -793,8 +794,9 @@ pub fn run(
Ok(true) => {
// Update successful, kill current process so it will be restart
if let Some(ref mut child) = child_option {
let id = child.id();
println!("Killing pid {}: {:?}", id, child.kill());
stop_process(child).unwrap_or_else(|err| {
eprintln!("Failed to stop child: {:?}", err);
});
}
}
Ok(false) => {} // No update available