proc-ctl

Crates.ioproc-ctl
lib.rsproc-ctl
version0.4.0
sourcesrc
created_at2023-05-02 16:27:16.022357
updated_at2024-11-06 02:32:13.453048
descriptionA helper library for querying and manipulating processes
homepage
repositoryhttps://github.com/EphyraSoftware/proc-ctl
max_upload_size
id854718
size83,091
raw-window-metal (github:rust-windowing:raw-window-metal)

documentation

README

proc-ctl

A helper library for querying and manipulating processes.

Find what port a process is using

use proc_ctl::PortQuery;

let query = PortQuery::new()
    .tcp_only()
    .ip_v4_only()
    .process_id(55932) // Get a process ID from somewhere
    .expect_min_num_ports(1);

query.execute().unwrap();

Find processes by name

use proc_ctl::{ProcCtlResult, ProcQuery};

fn main() -> ProcCtlResult<()> {

    let query = ProcQuery::new()
        .process_name("firefox");

    let processes = query.list_processes()?;
    Ok(())
}

Find the children of a given process

use proc_ctl::{ProcCtlResult, ProcQuery};

fn main() -> ProcCtlResult<()> {
    let query = ProcQuery::new()
        .process_id(55932) // Get a process ID from somewhere
        .expect_min_num_children(1);

    query.children()?;
    Ok(())
}
Commit count: 49

cargo fmt