summaryrefslogtreecommitdiffstats
path: root/src/app/process_killer.rs
blob: e91034c462ab9cb3a2296894634dd9afd4f2590b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/// This file is meant to house (OS specific) implementations on how to kill processes.
use std::process::Command;

/// Kills a process, given a PID.
pub fn kill_process_given_pid(pid : u64) -> crate::utils::error::Result<()> {
	if cfg!(target_os = "linux") {
		// Linux
		Command::new("kill").arg(pid.to_string()).output()?;
	}
	else if cfg!(target_os = "windows") {
		// Windows
		debug!("Sorry, Windows support is not implemented yet!");
	}
	else if cfg!(target_os = "macos") {
		// TODO: macOS
		debug!("Sorry, macOS support is not implemented yet!");
	}
	else {
		// TODO: Others?
		debug!("Sorry, other support this is not implemented yet!");
	}

	Ok(())
}