Only kill process if not already dead

This commit is contained in:
Kovid Goyal 2019-02-02 15:56:51 +05:30
parent bfac482940
commit 9916802a69
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -779,8 +779,7 @@ class Boss:
def destroy(self): def destroy(self):
self.shutting_down = True self.shutting_down = True
self.child_monitor.shutdown_monitor() self.child_monitor.shutdown_monitor()
if self.update_check_process is not None: self.set_update_check_process()
self.update_check_process.kill()
self.update_check_process = None self.update_check_process = None
del self.child_monitor del self.child_monitor
for tm in self.os_window_map.values(): for tm in self.os_window_map.values():
@ -986,7 +985,13 @@ class Boss:
except FileNotFoundError: except FileNotFoundError:
pass pass
def set_update_check_process(self, process): def set_update_check_process(self, process=None):
if self.update_check_process is not None:
try:
if self.update_check_process.poll() is None:
self.update_check_process.kill()
except Exception:
pass
self.update_check_process = process self.update_check_process = process
def on_monitored_pid_death(self, pid, exit_status): def on_monitored_pid_death(self, pid, exit_status):