From b22c07aba27f3d0f72568250139000f36bc1a8b9 Mon Sep 17 00:00:00 2001 From: ClementTsang Date: Wed, 1 Jan 2020 23:39:47 -0500 Subject: Added dialog for dd, added error message if fail to dd, cleaned up some stuff --- src/app/process_killer.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/app') diff --git a/src/app/process_killer.rs b/src/app/process_killer.rs index b6793f39..34ec0a99 100644 --- a/src/app/process_killer.rs +++ b/src/app/process_killer.rs @@ -1,8 +1,7 @@ /// This file is meant to house (OS specific) implementations on how to kill processes. +use crate::utils::error::{BottomError, Result}; use std::process::Command; -// TODO: Make it update process list on freeze. - // Copied from SO: https://stackoverflow.com/a/55231715 #[cfg(target_os = "windows")] use winapi::{ @@ -33,7 +32,7 @@ impl Process { } /// Kills a process, given a PID. -pub fn kill_process_given_pid(pid: u64) -> crate::utils::error::Result<()> { +pub fn kill_process_given_pid(pid: u32) -> Result<()> { if cfg!(target_os = "linux") { // Linux Command::new("kill").arg(pid.to_string()).output()?; @@ -45,10 +44,14 @@ pub fn kill_process_given_pid(pid: u64) -> crate::utils::error::Result<()> { } else if cfg!(target_os = "macos") { // TODO: macOS // See how sysinfo does it... https://docs.rs/sysinfo/0.9.5/sysinfo/trait.ProcessExt.html - debug!("Sorry, macOS support is not implemented yet!"); + return Err(BottomError::GenericError { + message: "Sorry, macOS support is not implemented yet!".to_string(), + }); } else { // TODO: Others? - debug!("Sorry, other support this is not implemented yet!"); + return Err(BottomError::GenericError { + message: "Sorry, support operating systems outside the main three is not implemented yet!".to_string(), + }); } Ok(()) -- cgit v1.2.3