File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ def main():
143143 if not options .files :
144144 inactive .extend (('read_files' , 'write_files' ))
145145 metrics = define_actions (inactive )
146+ found_process = False
146147 try :
147148 with open (options .output_file , 'w' ) if options .output_file else sys .stdout as file :
148149 print (status_header (metrics ), file = file )
@@ -157,11 +158,13 @@ def main():
157158 print ('Zombie process encountered' , file = sys .stderr )
158159 print ('\n ' .join (process_info ), file = file )
159160 time .sleep (options .delta )
160- except psutil .NoSuchProcess :
161- # the process has terminated, but this is to be expected
162- pass
163161 except KeyboardInterrupt :
164162 pass
163+ except psutil .NoSuchProcess :
164+ if not found_process :
165+ print (f'Process { options .pid } does not exist' , file = sys .stderr )
166+ return 1
167+ return 0
165168
166169
167170if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments