Ignore:
Timestamp:
Sep 7, 2006, 10:31:17 AM (18 years ago)
Author:
garonne
Message:

MàJ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tbroadcast/v2/python/executer.py

    r232 r244  
    131131            return self.__generateSystemCommandError( "Exceeded maximum buffer size ( %d bytes ) timeout for '%s' call" % ( self.iBufferLimit, self.sCmd ) )
    132132
    133     def systemCall( self, sCmd, oCallbackFunction = None ):
     133    def systemCall( self, sCmd, oCallbackFunction = None, arg=None ):
    134134        self.sCmd = sCmd
    135135        self.oCallback = oCallbackFunction
     136        self.arg    = arg
    136137        self.oChild = popen2.Popen3( self.sCmd, True )
    137138        self.lBuffers = [ [ "", 0 ], [ "", 0 ] ]
     
    182183        iNextLine = self.lBuffers[ iIndex ][0][ self.lBuffers[ iIndex ][1]: ].find( "\n" )
    183184        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 )
    185186            self.lBuffers[ iIndex ][1] += iNextLine + 1
    186187            return True
     
    196197
    197198############################################################################     
    198 def exeCommand( sCmd, iTimeout = 0, oLineCallback = redirectOutput):
     199def exeCommand( sCmd, iTimeout = 0, oLineCallback = redirectOutput, arg=None):
    199200    """Return ( status, output, error, pythonError ) of executing cmd in a shell."""
    200201    oSPE = SubprocessExecuter( iTimeout )
    201     retVal = oSPE.systemCall( sCmd, oLineCallback )
     202    retVal = oSPE.systemCall( sCmd, oLineCallback, arg=arg)
    202203    if retVal[ 'OK' ]:
    203204        return retVal[ 'Value' ][0], retVal[ 'Value' ][1], retVal[ 'Value' ][2], 0
Note: See TracChangeset for help on using the changeset viewer.