+def process_is_dead(pid):
+ """ Tests whether the process is dead already """
+ try:
+ os.kill(pid, 0)
+ except ProcessLookupError:
+ return True
+ except OSError as err:
+ if err.errno == errno.ESRCH: # ESRCH == No such process. The process is now dead
+ return True
+ return False
+
+def kill_process_group(pid):
+ """ This function send TERM signal + KILL signal after 0.2s to the group of the specified process """
+ if pid is None:
+ # Nobody to kill. We don't know who to kill on windows, or we don't have anyone to kill on signal handler
+ return