pub fn build_chain_string(store: &impl ProcessStore, pid: u32) -> StringExpand description
Build a chain string from the process tree.
Format: "102|touch|root;101|sh|root;100|openclaw|root;1|systemd|root"
use proc_tree::{DefaultStore, build_chain_string, ProcessStore, ProcessInfo};
let store = DefaultStore::new(0);
store.insert_process(1, ProcessInfo { ppid: 0, cmd: "init".into(), user: "root".into(), tgid: 1, start_time_ns: 0 });
store.insert_process(100, ProcessInfo { ppid: 1, cmd: "sshd".into(), user: "root".into(), tgid: 100, start_time_ns: 0 });
store.insert_process(200, ProcessInfo { ppid: 100, cmd: "bash".into(), user: "root".into(), tgid: 200, start_time_ns: 0 });
let chain = build_chain_string(&store, 200);
assert_eq!(chain, "200|bash|root;100|sshd|root;1|init|root");