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

Class RedirectedExecutable

source code

   object --+        
            |        
   Executable --+    
                |    
TimeoutExecutable --+
                    |
                   RedirectedExecutable

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

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

Inherited from TimeoutExecutable: Run, __init__

Inherited from Executable: Kill, Spawn

Inherited from Executable (private): _CreateCommandLine, _GetChildPID

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_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)

_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: Executable._InitializeChild
(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: Executable._HandleChild
(inherited documentation)

_DoParent(self)

source code 

Perform actions required in the parent after 'Spawn'.

Overrides: Executable._DoParent
(inherited documentation)

_WriteStdin(self)

source code 

Write to the standard input pipe.

This implementation writes no data and closes the pipe.

_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.

_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.

_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'.

__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.