diff options
author | ClementTsang <clementjhtsang@gmail.com> | 2020-01-01 23:39:47 -0500 |
---|---|---|
committer | ClementTsang <clementjhtsang@gmail.com> | 2020-01-01 23:39:47 -0500 |
commit | b22c07aba27f3d0f72568250139000f36bc1a8b9 (patch) | |
tree | 8b22725b7f895e8f936e9c7040dabe123cb9fee0 /src/app | |
parent | 7208908413c49deccefa2c2de2272407b6278b02 (diff) |
Added dialog for dd, added error message if fail to dd, cleaned up some stuff
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/process_killer.rs | 13 |
1 files changed, 8 insertions, 5 deletions
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(()) |