commit: fb73cabb4a601a8172d6de653851c4a348b6abc1
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 00:39:49 2015 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 00:39:49 2015 +0000
URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=fb73cabb
grs/Execute.py: refactor signalexit().
grs/Execute.py | 18 +++++++-----------
1 file 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!