t.i.i.IReactorProcess(Interface) : interface documentation

Part of twisted.internet.interfaces View Source View In Hierarchy

Known implementations: twisted.internet.iocpreactor.reactor.IOCPReactor, twisted.internet.posixbase.PosixReactorBase, twisted.internet.win32eventreactor.Win32Reactor

No interface docstring
Method spawnProcess Spawn a process, with a process protocol.
def spawnProcess(processProtocol, executable, args=(), env={}, path=None, uid=None, gid=None, usePTY=0, childFDs=None): (source)
Spawn a process, with a process protocol.
ParametersprocessProtocolAn object which will be notified of all events related to the created process. (type: IProcessProtocol provider )
executablethe file name to spawn - the full path should be used.
argsthe command line arguments to pass to the process; a sequence of strings. The first string should be the executable's name.
envthe environment variables to pass to the processs; a dictionary of strings. If 'None', use os.environ.
paththe path to run the subprocess in - defaults to the current directory.
uiduser ID to run the subprocess as. (Only available on POSIX systems.)
gidgroup ID to run the subprocess as. (Only available on POSIX systems.)
usePTYif true, run this process in a pseudo-terminal. optionally a tuple of (masterfd, slavefd, ttyname), in which case use those file descriptors. (Not available on all systems.)
childFDs

A dictionary mapping file descriptors in the new child process to an integer or to the string 'r' or 'w'.

If the value is an integer, it specifies a file descriptor in the parent process which will be mapped to a file descriptor (specified by the key) in the child process. This is useful for things like inetd and shell-like file redirection.

If it is the string 'r', a pipe will be created and attached to the child at that file descriptor: the child will be able to write to that file descriptor and the parent will receive read notification via the IProcessProtocol.childDataReceived callback. This is useful for the child's stdout and stderr.

If it is the string 'w', similar setup to the previous case will occur, with the pipe being readable by the child instead of writeable. The parent process can write to that file descriptor using IProcessTransport.writeToChild. This is useful for the child's stdin.

If childFDs is not passed, the default behaviour is to use a mapping that opens the usual stdin/stdout/stderr pipes.
ReturnsAn object which provides IProcessTransport.
RaisesOSErrorRaised with errno EAGAIN or ENOMEM if there are insufficient system resources to create a new process.
See Alsotwisted.internet.protocol.ProcessProtocol
API Documentation for Twisted, generated by pydoctor at 2011-10-27 15:57:47.