Changeset 244 for tbroadcast/v2/python/executer.py
- Timestamp:
- Sep 7, 2006, 10:31:17 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tbroadcast/v2/python/executer.py
r232 r244 131 131 return self.__generateSystemCommandError( "Exceeded maximum buffer size ( %d bytes ) timeout for '%s' call" % ( self.iBufferLimit, self.sCmd ) ) 132 132 133 def systemCall( self, sCmd, oCallbackFunction = None ):133 def systemCall( self, sCmd, oCallbackFunction = None, arg=None ): 134 134 self.sCmd = sCmd 135 135 self.oCallback = oCallbackFunction 136 self.arg = arg 136 137 self.oChild = popen2.Popen3( self.sCmd, True ) 137 138 self.lBuffers = [ [ "", 0 ], [ "", 0 ] ] … … 182 183 iNextLine = self.lBuffers[ iIndex ][0][ self.lBuffers[ iIndex ][1]: ].find( "\n" ) 183 184 if iNextLine > -1: 184 self.oCallback( iIndex, self.lBuffers[ iIndex ][0][ self.lBuffers[ iIndex ][1]: self.lBuffers[ iIndex ][1] + iNextLine ] )185 self.oCallback( iIndex, self.lBuffers[ iIndex ][0][ self.lBuffers[ iIndex ][1]: self.lBuffers[ iIndex ][1] + iNextLine ], arg=self.arg ) 185 186 self.lBuffers[ iIndex ][1] += iNextLine + 1 186 187 return True … … 196 197 197 198 ############################################################################ 198 def exeCommand( sCmd, iTimeout = 0, oLineCallback = redirectOutput ):199 def exeCommand( sCmd, iTimeout = 0, oLineCallback = redirectOutput, arg=None): 199 200 """Return ( status, output, error, pythonError ) of executing cmd in a shell.""" 200 201 oSPE = SubprocessExecuter( iTimeout ) 201 retVal = oSPE.systemCall( sCmd, oLineCallback 202 retVal = oSPE.systemCall( sCmd, oLineCallback, arg=arg) 202 203 if retVal[ 'OK' ]: 203 204 return retVal[ 'Value' ][0], retVal[ 'Value' ][1], retVal[ 'Value' ][2], 0
Note: See TracChangeset
for help on using the changeset viewer.