File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ def main():
143
143
if not options .files :
144
144
inactive .extend (('read_files' , 'write_files' ))
145
145
metrics = define_actions (inactive )
146
+ found_process = False
146
147
try :
147
148
with open (options .output_file , 'w' ) if options .output_file else sys .stdout as file :
148
149
print (status_header (metrics ), file = file )
@@ -157,11 +158,13 @@ def main():
157
158
print ('Zombie process encountered' , file = sys .stderr )
158
159
print ('\n ' .join (process_info ), file = file )
159
160
time .sleep (options .delta )
160
- except psutil .NoSuchProcess :
161
- # the process has terminated, but this is to be expected
162
- pass
163
161
except KeyboardInterrupt :
164
162
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
165
168
166
169
167
170
if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments