Fix 'ps -l' output when a process doesn't have a parent process. (#3015)

Before, ps would not insert a value if the process didn't have a parent.
Now, ps will insert an empty cell. This caused broken tables as some
rows didn't have all the columns.
This commit is contained in:
Qwanve 2021-02-06 02:41:08 -07:00 committed by GitHub
parent 85329f9a81
commit d66baaceb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,8 @@ pub async fn ps(tag: Tag, long: bool) -> Result<Vec<Value>, ShellError> {
if long {
if let Some(parent) = result.parent() {
dict.insert_untagged("parent", UntaggedValue::int(parent));
} else {
dict.insert_untagged("parent", UntaggedValue::nothing());
}
dict.insert_untagged("exe", UntaggedValue::filepath(result.exe()));
dict.insert_untagged("command", UntaggedValue::string(result.cmd().join(" ")));