qm :: executable :: RedirectedExecutable :: Class RedirectedExecutable
[hide private]
[frames] | no frames]

Class RedirectedExecutable
source code

   object --+        
            |        
   Executable --+    
                |    
TimeoutExecutable --+
                    |
                   RedirectedExecutable
Known Subclasses:
host.Host.Executable, Filter, test.classes.dejagnu_test.DejaGNUTest.BuildExecutable, test.classes.compiler.CompilerExecutable

A 'RedirectedExecutable' redirects the standard I/O streams.

Instance Methods [hide private]
  _ClosePipeEnd(self, fd)
Close the file descriptor 'fd', which is one end of a pipe.
  _CreatePipe(self)
Return a new pipe.
  _DoParent(self)
Perform actions required in the parent after 'Spawn'.
  _HandleChild(self)
Run in the parent process after the child has been created.
  _InitializeChild(self)
Initialize the child process.
  _InitializeParent(self)
Initialize the parent process.
  _ReadStderr(self)
Read from the standard error pipe.
  _ReadStdout(self)
Read from the standard output pipe.
  _StderrPipe(self)
Return a pipe to which to redirect the standard input.
  _StdinPipe(self)
Return a pipe to which to redirect the standard input.
  _StdoutPipe(self)
Return a pipe to which to redirect the standard output.
  _WriteStdin(self)
Write to the standard input pipe.
  __CallUntilNone(self, f, attribute)
Call 'f' until 'self.attribute' is 'None'.
  __UninheritableHandle(self, handle)
Return a duplicate of a file handle that is not inheritable.

Inherited from TimeoutExecutable: Run, __init__

Inherited from Executable: Kill, Spawn

Inherited from Executable (private): _GetChildPID

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]

Inherited from object: __class__


Method Details [hide private]

_ClosePipeEnd(self, fd)

source code 

Close the file descriptor 'fd', which is one end of a pipe.

'fd' -- Under UNIX, a file descriptor. Under Windows, a handle.

_CreatePipe(self)

source code 

Return a new pipe.

returns -- A tuple (under UNIX) or list (under Windows) consisting of the file descriptors (UNIX) or handles (Windows) for the read end and write end of a new pipe. The pipe is inheritable by child processes. On UNIX the fds will not be inherited across 'exec'.

_DoParent(self)

source code 
Perform actions required in the parent after 'Spawn'.
Overrides: Executable._DoParent
(inherited documentation)

_HandleChild(self)

source code 

Run in the parent process after the child has been created.

The child process has been spawned; its PID is avialable via '_GetChildPID'. Take any actions in the parent that are required now that the child exists.

Derived class versions must call this method.
Overrides: TimeoutExecutable._HandleChild

_InitializeChild(self)

source code 

Initialize the child process.

After 'fork' is called this method is invoked to give the child a chance to initialize itself. '_InitializeParent' will already have been called in the parent process.

This method is not used under Windows.
Overrides: TimeoutExecutable._InitializeChild

_InitializeParent(self)

source code 

Initialize the parent process.

Before spawning the child, this method is invoked to give the parent a chance to initialize itself.

returns -- Under Windows, a 'PySTARTUPINFO' structure explaining how the child should be initialized. On other systems, the return value is ignored.
Overrides: Executable._InitializeParent
(inherited documentation)

_ReadStderr(self)

source code 
Read from the standard error pipe.

_ReadStdout(self)

source code 
Read from the standard output pipe.

_StderrPipe(self)

source code 

Return a pipe to which to redirect the standard input.

returns -- A pipe, or 'None'. If 'None' is returned, but '_StdoutPipe' returns a pipe, then the standard error and standard input will both be redirected to that pipe. However, if '_StdoutPipe' also returns 'None', then the standard error will be closed in the child.

_StdinPipe(self)

source code 

Return a pipe to which to redirect the standard input.

returns -- A pipe, or 'None' if the standard input should be closed in the child.

_StdoutPipe(self)

source code 

Return a pipe to which to redirect the standard output.

returns -- A pipe, or 'None' if the standard output should be closed in the child.

_WriteStdin(self)

source code 

Write to the standard input pipe.

This implementation writes no data and closes the pipe.

__CallUntilNone(self, f, attribute)

source code 

Call 'f' until 'self.attribute' is 'None'.

'f' -- A callable.

'attribute' -- A string giving the name of an attribute.

__UninheritableHandle(self, handle)

source code 

Return a duplicate of a file handle that is not inheritable.

'handle' -- A file handle.

returns -- A new handle that is a non-inheritable duplicate of the 'handle'.

This method should only be used under Windows.