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():
158
158
inactive .extend (('read_files' , 'write_files' ))
159
159
metrics = define_actions (inactive )
160
160
file = open (options .output_file , 'w' ) if options .output_file else sys .stdout
161
+ found_process = False
161
162
try :
162
163
with file :
163
164
print (status_header (metrics ), file = file )
@@ -167,10 +168,16 @@ def main():
167
168
process_status (child_process , metrics )
168
169
for child_process in process .children (recursive = True )
169
170
)
170
- print ('\n ' .join (process_info ), file = file )
171
+ print ('\n ' .join (process_info ), file = file , flush = True )
172
+ found_process = True
171
173
time .sleep (options .delta )
172
174
except KeyboardInterrupt :
173
175
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
174
181
175
182
176
183
if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments