2 releases

Uses old Rust 2015

0.1.1 Feb 13, 2017
0.1.0 Sep 19, 2016

#9 in #process-id

Download history 29/week @ 2023-12-10 4/week @ 2023-12-17 6/week @ 2024-02-18 44/week @ 2024-02-25 35/week @ 2024-03-03

85 downloads per month

MIT license

590KB
332 lines

pentry: Process Entry Inspection Library for Rust

mitchellh/go-ps のようにプロセスの実行ファイルを取得したかった。

使い方 - Usage -

依存関係の追加 - Add Dependencies -

[dependencies]
pentry = "0.1.*"

サンプルコード - Samples -

自分自身を取得するサンプル - Inspect SELF process -

extern crate pentry;

if let Ok(ps) = pentry::current() {
    println!("{:?}", ps);
}

親プロセスを取得する - Inspect Parent Process -

extern crate pentry;

if let Ok(ps) = pentry::current() {
    println!("Current: {:?}", ps);

    // 1. Use pentry::find
    if let Ok(parent) = pentry::find(ps.ppid()) {
        println!("Parent: {:?}", parent);
    }

    // 2. Use `parent` member function.
    println!("Parent: {:?}", ps.parent().unwrap());
}

作者 - Author -

TANAKA Kenichi aka chikuchikugonzalez (ちくちく('ω')ごんざれす)

ライセンス - LICENSE -

MIT License

Dependencies