ajack 2003/12/16 12:43:42
Modified: python/gump/utils launcher.py
Log:
Try to cope w/ system() response on Windoze.
Revision Changes Path
1.6 +22 -12 jakarta-gump/python/gump/utils/launcher.py
Index: launcher.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/utils/launcher.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- launcher.py 12 Dec 2003 16:32:51 -0000 1.5
+++ launcher.py 16 Dec 2003 20:43:42 -0000 1.6
@@ -445,20 +445,29 @@
#
# Execute Command & Wait
#
- waitcode=os.system(execString + ' >>' + str(outputFile) + ' 2>&1')
+ systemReturn=os.system(execString + ' >>' + str(outputFile) + ' 2>&1')
- #
- # The return code (from system = from wait) is (on Unix):
- #
- # a 16 bit number
- # top byte = exit status
- # low byte = signal that killed it
- #
- result.signal=(waitcode & 0xFF)
- result.exit_code=(((waitcode & 0xFF00) >> 8) & 0xFF)
+ if not os.name == 'dos' and not os.name == 'nt':
+ waitcode=systemReturn
+
+ #
+ # The return code (from system = from wait) is (on Unix):
+ #
+ # a 16 bit number
+ # top byte = exit status
+ # low byte = signal that killed it
+ #
+ result.signal=(waitcode & 0xFF)
+ result.exit_code=(((waitcode & 0xFF00) >> 8) & 0xFF)
- log.debug('Command . [' + str(waitcode)+ '] [Sig:' + str(result.signal) + '
/ Exit:' + str(result.exit_code) + '].')
+ else:
+
+ result.signal=0
+ result.exit_code=systemReturn
+ log.debug('Command -> [' + str(systemReturn)+ '] [Sig:' +
str(result.signal) + ' / Exit:' + str(result.exit_code) + '].')
+ print 'Command -> [' + str(systemReturn)+ '] [Sig:' + str(result.signal) +
' / Exit:' + str(result.exit_code) + '].'
+
#
# Assume timed out if signal terminated
#
@@ -470,7 +479,8 @@
result.state=CMD_STATE_FAILED
log.error('Command failed. [' + execString + ']. ExitCode: ' +
str(result.exit_code))
else:
- result.state=CMD_STATE_SUCCESS
+ result.state=CMD_STATE_SUCCESS
+
#
# Stop it (if still running)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]