From c2024a5f9e50ecac2fbb874c90043e81c96898cd Mon Sep 17 00:00:00 2001 From: Hulto <7121375+hulto@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:35:59 -0500 Subject: [PATCH] Fix error when process ID is known but not metadata --- tavern/tomes/process_tree/main.eldritch | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tavern/tomes/process_tree/main.eldritch b/tavern/tomes/process_tree/main.eldritch index 14ae296f9..901f6d309 100644 --- a/tavern/tomes/process_tree/main.eldritch +++ b/tavern/tomes/process_tree/main.eldritch @@ -16,13 +16,22 @@ def depth_first_search(visited, process_tree, current_proc_pid, padding, process if padding > 0: padding_string = (padding - 1) * " " + " \_ " - if current_proc_pid != "0": + if current_proc_pid != "0" and current_proc_pid in process_list_dictionary: print( pad_pid(current_proc_pid) +\ pad_pid(process_list_dictionary[current_proc_pid]["ppid"]) +\ pad_username(process_list_dictionary[current_proc_pid]["username"]) +\ padding_string + process_list_dictionary[current_proc_pid]["command"].replace("\n","\\n") ) + else: + print( + pad_pid(current_proc_pid) +\ + pad_pid("???") +\ + pad_username("???") +\ + padding_string + "???".replace("\n","\\n") + ) + + padding = padding + 1 @@ -76,3 +85,4 @@ time.sleep(1) process_tree(input_params['cmd_substring']) print("") +