File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ def main():
158158 inactive .extend (('read_files' , 'write_files' ))
159159 metrics = define_actions (inactive )
160160 file = open (options .output_file , 'w' ) if options .output_file else sys .stdout
161+ found_process = False
161162 try :
162163 with file :
163164 print (status_header (metrics ), file = file )
@@ -167,10 +168,16 @@ def main():
167168 process_status (child_process , metrics )
168169 for child_process in process .children (recursive = True )
169170 )
170- print ('\n ' .join (process_info ), file = file )
171+ print ('\n ' .join (process_info ), file = file , flush = True )
172+ found_process = True
171173 time .sleep (options .delta )
172174 except KeyboardInterrupt :
173175 pass
176+ except psutil .NoSuchProcess :
177+ if not found_process :
178+ print (f'Process { options .pid } does not exist' , file = sys .stderr )
179+ return 1
180+ return 0
174181
175182
176183if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments