Crates.io | port-killer |
lib.rs | port-killer |
version | 0.1.0 |
source | src |
created_at | 2022-05-13 17:28:06.87429 |
updated_at | 2022-05-13 17:28:06.87429 |
description | port-killer is a rust library that provides functions to clear port occupancy and kill processes. |
homepage | https://github.com/ZingerLittleBee/port-killer-rs |
repository | https://github.com/ZingerLittleBee/port-killer-rs |
max_upload_size | |
id | 585990 |
size | 14,383 |
Language : 🇺🇸 English | 🇨🇳 简体中文
port-killer is a rust library that provides functions to clear port occupancy and kill processes.
Get the latest version -> https://crates.io/crates/port-killer
Add the dependent
[dependencies]
port-killer = "0.1.0"
use port_killer::{kill, kill_by_pids};
fn main() {
assert!(kill(5000).expect(""));
assert!(kill_by_pids(&[56812]).expect(""));
}
fn -> kill · kill_by_pids
kill
Clear port occupancy by port
pub fn kill(port: u16) -> Result<bool, Error>
kill_by_pids
Kill processes based on pids
pub fn kill_by_pids(pids: &[u32]) -> Result<bool, Error>