Skip to main content

Give a better error message when no processes found

ID
16c4ea6
date
2023-12-13 09:38:24+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
af407fd
message
Give a better error message when no processes found
changed files
1 file, 3 additions, 1 deletion

Changed files

macos/find_processes_using_secure_input (3066) → macos/find_processes_using_secure_input (3146)

diff --git a/macos/find_processes_using_secure_input b/macos/find_processes_using_secure_input
index f519dcb..ade800d 100755
--- a/macos/find_processes_using_secure_input
+++ b/macos/find_processes_using_secure_input
@@ -85,11 +85,13 @@ if __name__ == "__main__":
         for pid in sorted(int(p) for p in process_ids)
     ]
 
-    print("The following processes are using Secure Input:")
     if sorted_pids:
+        print("The following processes are using Secure Input:")
         subprocess.check_call([
             "ps",
             "-c",                        # Only show the executable name, not the full command line
             "-o", "pid=,command=",        # Only show the PID/command column, no header
             "-p", ",".join(sorted_pids)  # Only get the selected processes
         ])
+    else:
+        print("I can’t find any processes using Secure Input!")