aboutsummaryrefslogtreecommitdiff
path: root/grs
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-10-09 20:39:49 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-10-09 20:39:49 -0400
commitfb73cabb4a601a8172d6de653851c4a348b6abc1 (patch)
tree69d65512ee277110b07b11e1d6be097c964cd4a5 /grs
parentgrs/Interpret.py: restructure semantic actions. (diff)
downloadgrss-fb73cabb4a601a8172d6de653851c4a348b6abc1.tar.gz
grss-fb73cabb4a601a8172d6de653851c4a348b6abc1.tar.bz2
grss-fb73cabb4a601a8172d6de653851c4a348b6abc1.zip
grs/Execute.py: refactor signalexit().
Diffstat (limited to 'grs')
-rw-r--r--grs/Execute.py18
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!