diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2015-10-09 20:39:49 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2015-10-09 20:39:49 -0400 |
commit | fb73cabb4a601a8172d6de653851c4a348b6abc1 (patch) | |
tree | 69d65512ee277110b07b11e1d6be097c964cd4a5 | |
parent | grs/Interpret.py: restructure semantic actions. (diff) | |
download | grss-fb73cabb4a601a8172d6de653851c4a348b6abc1.tar.gz grss-fb73cabb4a601a8172d6de653851c4a348b6abc1.tar.bz2 grss-fb73cabb4a601a8172d6de653851c4a348b6abc1.zip |
grs/Execute.py: refactor signalexit().
-rw-r--r-- | grs/Execute.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/grs/Execute.py b/grs/Execute.py index 3afbecc..0690e8e 100644 --- a/grs/Execute.py +++ b/grs/Execute.py @@ -44,17 +44,9 @@ class Execute(): """ def signalexit(): pid = os.getpid() - _file.write('SENDING SIGTERM to pid = %d\n' % pid) - _file.close() - try: - for i in range(10): - os.kill(pid, signal.SIGTERM) - time.sleep(0.2) - while True: - os.kill(pid, signal.SIGKILL) - time.sleep(0.2) - except ProcessLookupError: - pass + while True: + os.kill(pid, signal.SIGTERM) + time.sleep(2.0) if shell: args = cmd @@ -82,11 +74,15 @@ class Execute(): if _rc: _file.write('EXIT CODE: %d\n' % _rc) if not failok: + _file.write('SENDING SIGTERM to pid = %d\n' % pid) + _file.close() signalexit() if timed_out: _file.write('TIMEOUT ERROR: %s\n' % cmd) if not failok: + _file.write('SENDING SIGTERM to pid = %d\n' % pid) + _file.close() signalexit() # Only close a logfile, don't close sys.stderr! |