Skip to content

ZingerLittleBee/port-killer-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language : 🇺🇸 English | 🇨🇳 简体中文

port-killer

Build Status Crates Downloads Last Commit

Docs GitHub Actions Analyze LICENSE

Overview

port-killer is a rust library that provides functions to clear port occupancy and kill processes.

Installation

  1. Get the latest version -> https://crates.io/crates/port-killer

  2. Add the dependent

[dependencies]
port-killer = "0.1.0"
  1. Usage
use port_killer::{kill, kill_by_pids};

fn main() {
    assert!(kill(5000).expect(""));
    assert!(kill_by_pids(&[56812]).expect(""));
}

Goods

fn -> kill · kill_by_pids

Documentation

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>