Class t.i.i.p.Process(object):

Part of twisted.internet.iocpreactor.process View Source View In Hierarchy

Implements interfaces: twisted.internet.interfaces.IConsumer, twisted.internet.interfaces.IProcessTransport

A process that integrates with the Twisted event loop.

See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating_a_child_process_with_redirected_input_and_output.asp for more info on how to create processes in Windows and access their stdout/err/in. Another good source is http://www.informit.com/articles/article.asp?p=362660&seqNum=2.

Issues:

If your subprocess is a python program, you need to:
Method __init__ Undocumented
Method signalProcess Send a signal to the process.
Method startWriting Undocumented
Method stopWriting Undocumented
Method writeDone Undocumented
Method write Write data to the process' stdin.
Method writeSequence Write a list of strings to the physical connection.
Method closeStdin Close the process' stdin.
Method _closeStdin Undocumented
Method closeStderr Close stderr.
Method closeStdout Close stdout.
Method loseConnection Close the process' stdout, in and err.
Method outConnectionLost Undocumented
Method errConnectionLost Undocumented
Method inConnectionLost Undocumented
Method connectionLostNotify Will be called 3 times, for stdout/err/in.
Method processEnded Undocumented
Method connectionLost Shut down resources.
Method registerProducer Register to receive data from a producer.
Method unregisterProducer Stop consuming data from a producer, without disconnecting.
def __init__(self, reactor, protocol, command, args, environment, path): (source)
Undocumented
def signalProcess(self, signalID): (source)
Send a signal to the process.
ParameterssignalIDcan be
  • one of "HUP", "KILL", "STOP", or "INT". These will be implemented in a cross-platform manner, and so should be used if possible.
  • an integer, where it represents a POSIX signal ID.
Raisestwisted.internet.error.ProcessExitedAlreadyThe process has already exited.
def startWriting(self): (source)
Undocumented
def stopWriting(self): (source)
Undocumented
def writeDone(self, bytes): (source)
Undocumented
def write(self, data): (source)
Write data to the process' stdin.
def writeSequence(self, seq): (source)

Write a list of strings to the physical connection.

If possible, make sure that all of the data is written to the socket at once, without first copying it all into a single string.
def closeStdin(self): (source)
Close the process' stdin.
def _closeStdin(self): (source)
Undocumented
def closeStderr(self): (source)
Close stderr.
def closeStdout(self): (source)
Close stdout.
def loseConnection(self): (source)
Close the process' stdout, in and err.
def outConnectionLost(self): (source)
Undocumented
def errConnectionLost(self): (source)
Undocumented
def inConnectionLost(self): (source)
Undocumented
def connectionLostNotify(self): (source)
Will be called 3 times, for stdout/err/in.
def processEnded(self): (source)
Undocumented
def connectionLost(self, reason=None): (source)
Shut down resources.
def registerProducer(self, producer, streaming): (source)

Register to receive data from a producer.

This sets self to be a consumer for a producer. When this object runs out of data (as when a send(2) call on a socket succeeds in moving the last data from a userspace buffer into a kernelspace buffer), it will ask the producer to resumeProducing().

For IPullProducer providers, resumeProducing will be called once each time data is required.

For IPushProducer providers, pauseProducing will be called whenever the write buffer fills up and resumeProducing will only be called when it empties.
Parametersproducer(type: IProducer provider )
streamingTrue if producer provides IPushProducer, False if producer provides IPullProducer. (type: bool )
ReturnsNone
def unregisterProducer(self): (source)
Stop consuming data from a producer, without disconnecting.
API Documentation for twisted, generated by pydoctor.