From d66baaceb9b30cce962bd33bf18e408409ac6366 Mon Sep 17 00:00:00 2001 From: Qwanve <44913094+Qwanve@users.noreply.github.com> Date: Sat, 6 Feb 2021 02:41:08 -0700 Subject: [PATCH] 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. --- crates/nu_plugin_ps/src/ps.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/nu_plugin_ps/src/ps.rs b/crates/nu_plugin_ps/src/ps.rs index cdb9edace..d710de253 100644 --- a/crates/nu_plugin_ps/src/ps.rs +++ b/crates/nu_plugin_ps/src/ps.rs @@ -45,6 +45,8 @@ pub async fn ps(tag: Tag, long: bool) -> Result, 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(" ")));