ajack 2003/10/20 11:44:52
Modified: python/gump launcher.py
Log:
If at first you don't succeed ...
... you are probably writting in Python.. :(
Revision Changes Path
1.26 +22 -14 jakarta-gump/python/gump/launcher.py
Index: launcher.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/launcher.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- launcher.py 20 Oct 2003 18:20:34 -0000 1.25
+++ launcher.py 20 Oct 2003 18:44:52 -0000 1.26
@@ -286,21 +286,27 @@
def killChildProcesses():
gumpid=default.gumpid
log.warn('Kill all child processed (anything launched by Gumpy) [PID' +
str(gumpid) + ']')
- command='pgrep -P ' + str(gumpid) + ' -l'
- ids=os.popen(command)
- try:
- line=ids.readline()
- while line:
- parts=line.split(' ')
- pid=parts[0]
- process=parts[1]
- if not process=='python':
- os.kill(childPID,signal.SIGKILL)
+ output = dir.tmp + '/childPIDs.txt'
+ command='pgrep -P ' + str(gumpid) + ' -l > ' + output
+ if os.system(command):
+ ids=None
+ try:
+ ids=open(output,'r')
+
+ line=ids.readline()
+ while line:
+ parts=line.split(' ')
+ childPID=int(parts[0])
+ process=parts[1]
+ if not process=='python':
+ log.warn('Terminate PID' + str(childPID) + '] Process: [' +
process + ']')
+ os.kill(childPID,signal.SIGKILL)
- # Get next PID/process combination
- line=o.readline()
- finally:
- if ids: ids.close()
+ # Get next PID/process combination
+ line=ids.readline()
+ finally:
+ if ids: ids.close()
+ log.warn('Terminated All.')
def execute(cmd,tmp=dir.tmp):
res=CmdResult(cmd)
@@ -372,6 +378,7 @@
# Set the signal handler and an N-second alarm
timeout=cmd.timeout or setting.timeout
timer = Timer(timeout, killChildProcesses)
+ timer.setDaemon(1)
timer.start()
# Execute Command & Wait
@@ -457,5 +464,6 @@
result = execute(cmd)
# dump(result);
+ exit(0)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]