Add ppid to ps command (#8750)

# Description

Adds the `ppid` field that's available on all supported platforms to the
`ps` command. This would be useful in my scripts.

# User-Facing Changes

- ps output now contains an extra column

# Tests + Formatting

Not sure if I need to add a test for this

# After Submitting

Update https://www.nushell.sh/book/quick_tour.html#quick-tour to show
the new table
This commit is contained in:
Jelle Besseling
2023-04-05 20:12:01 +02:00
committed by GitHub
parent 50ca77437d
commit 65c90d5b45
4 changed files with 21 additions and 0 deletions

View File

@ -86,6 +86,12 @@ fn run_ps(engine_state: &EngineState, call: &Call) -> Result<PipelineData, Shell
span,
});
cols.push("ppid".to_string());
vals.push(Value::Int {
val: proc.ppid() as i64,
span,
});
cols.push("name".to_string());
vals.push(Value::String {
val: proc.name(),