ajack 2004/07/19 15:34:04
Modified: python/gump/process command.py launcher.py
Log:
The new launcher was failing to set/pass TIMEOUT, so none existed.
Revision Changes Path
1.2 +1 -1 gump/python/gump/process/command.py
Index: command.py
===================================================================
RCS file: /home/cvs/gump/python/gump/process/command.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- command.py 14 Jul 2004 20:47:01 -0000 1.1
+++ command.py 19 Jul 2004 22:34:04 -0000 1.2
@@ -163,7 +163,7 @@
class Cmd:
"""Command Line (executable plus parameters)"""
- def __init__(self,command,name=None,cwd=None,env=None,timeout=None):
+ def __init__(self,command,name=None,cwd=None,env=None,timeout=setting.timeout):
self.cmdpath=command
self.name=name
if not self.name:
1.5 +23 -10 gump/python/gump/process/launcher.py
Index: launcher.py
===================================================================
RCS file: /home/cvs/gump/python/gump/process/launcher.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- launcher.py 19 Jul 2004 16:07:57 -0000 1.4
+++ launcher.py 19 Jul 2004 22:34:04 -0000 1.5
@@ -154,7 +154,7 @@
return result
-def killChildProcesses():
+def shutdownProcesses():
"""
Kill this (and all child processes).
"""
@@ -165,12 +165,14 @@
gumpid
except Exception, details:
log.error('Failed to dispatch signal ' + str(details), exc_info=1)
-
-if __name__=='__main__':
- import re
+
+def runProcess(execFilename):
+ """
- exit_code=0
- execFilename=sys.argv[1]
+ Read an 'exec file' (formatted by Gump) to detect what to run,
+ and how to run it.
+
+ """
execFile=None
try:
execFile=file(execFilename,'r')
@@ -186,8 +188,8 @@
cwd=None
if execInfo.has_key('CWD'):cwd=execInfo['CWD']
tmp=execInfo['TMP']
- timeout=None
- if execInfo.has_key('TIMEOUT'):timeout=execInfo['TIMEOUT']
+ timeout=0
+ if execInfo.has_key('TIMEOUT'):timeout=int(execInfo['TIMEOUT'])
# Make the TMP if needed
if not os.path.exists(tmp): os.makedirs(tmp)
@@ -206,8 +208,8 @@
# Timeout support
timer=None
if timeout:
- import thread
- timer = thread.Timer(timeout, killChildProcesses)
+ import threading
+ timer = threading.Timer(timeout, shutdownProcesses)
timer.setDaemon(1)
timer.start()
@@ -236,6 +238,17 @@
finally:
if execFile: execFile.close()
+
+ return exit_code
+
+if __name__=='__main__':
+ import re
+
+ exit_code=0
+ execFilename=sys.argv[1]
+
+ # Run the information within this file...
+ exit_code=runProcess(execFilename)
# print 'Exit: ' + `exit_code`
sys.exit(exit_code)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]