class twisted.internet._dumbwin32proc.Process(_pollingfile._PollingTimer, BaseProcess): (source)
Implements interfaces: twisted.internet.interfaces.IConsumer, twisted.internet.interfaces.IProcessTransport, twisted.internet.interfaces.IProducer
A process that integrates with the Twisted event loop.
If your subprocess is a python program, you need to:
import os, sys, mscvrt msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
Class Variable | closedNotifies | Undocumented |
Method | __init__ | Create a new child process. |
Instance Variable | hStdoutR | Undocumented |
Instance Variable | hStderrR | Undocumented |
Instance Variable | hStdinW | Undocumented |
Instance Variable | stdout | Undocumented |
Instance Variable | stderr | Undocumented |
Instance Variable | stdin | Undocumented |
Method | signalProcess | Send a signal to the process. |
Method | write | Write data to the process' stdin. |
Method | writeSequence | Write data to the process' stdin. |
Method | writeToChild | Similar to ITransport.write but also allows the file descriptor in the child process which will receive the bytes to be specified. |
Method | closeChildFD | Close a file descriptor which is connected to the child process, identified by its FD in the child process. |
Method | closeStdin | Close the process' stdin. |
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, by stdout/err threads and process handle. |
Method | maybeCallProcessEnded | Call processEnded on protocol after final cleanup. |
Instance Variable | hProcess | Undocumented |
Instance Variable | hThread | Undocumented |
Method | registerProducer | Register to receive data from a producer. |
Method | unregisterProducer | Stop consuming data from a producer, without disconnecting. |
Method | pauseProducing | Undocumented |
Method | resumeProducing | Undocumented |
Method | stopProducing | Stop producing data. |
Method | getHost | Similar to getPeer, but returns an address describing this side of the connection. |
Method | getPeer | Get the remote address of this connection. |
Method | __repr__ | Return a string representation of the process. |
Method | _getReason | Undocumented |
Inherited from _PollingTimer:
Instance Variable | reactor | Undocumented |
Instance Variable | _resources | Undocumented |
Instance Variable | _pollTimer | Undocumented |
Instance Variable | _currentTimeout | Undocumented |
Instance Variable | _paused | Undocumented |
Method | _addPollableResource | Undocumented |
Method | _checkPollingState | Undocumented |
Method | _startPolling | Undocumented |
Method | _stopPolling | Undocumented |
Method | _pause | Undocumented |
Method | _unpause | Undocumented |
Method | _reschedule | Undocumented |
Method | _pollEvent | Undocumented |
Inherited from BaseProcess:
Instance Variable | pid | Undocumented |
Instance Variable | status | Undocumented |
Class Variable | lostProcess | Undocumented |
Instance Variable | proto | Undocumented |
Method | processEnded | This is called when the child terminates. |
Method | _callProcessExited | Undocumented |
Create a new child process.
Send a signal to the process.
Parameters | signalID | can be
|
Raises | twisted.internet.error.ProcessExitedAlready | If the process has already exited. |
OSError | If the os.kill call fails with an errno different from ESRCH . |
Write data to the process' stdin.
Parameters | data | Undocumented (type: bytes ) |
Write data to the process' stdin.
Parameters | seq | Undocumented (type: list of bytes ) |
Similar to ITransport.write
but also allows the file descriptor in the child process which will receive the bytes to be specified.
This implementation is limited to writing to the child's standard input.
Parameters | fd | The file descriptor to which to write. Only stdin (0 ) is supported. (type: int ) |
data | The bytes to write. (type: bytes ) | |
Returns | None | |
Raises | KeyError | If fd is anything other than the stdin file descriptor (0 ). |
Close a file descriptor which is connected to the child process, identified by its FD in the child process.
Will be called 3 times, by stdout/err threads and process handle.
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. The consumer will only call resumeProducing
to balance a previous pauseProducing
call; the producer is assumed to start in an un-paused state.
Parameters | producer | Undocumented |
streaming | True if producer provides IPushProducer , False if producer provides IPullProducer . | |
Raises | RuntimeError | If a producer is already registered. |
Stop producing data.
This tells a producer that its consumer has died, so it must stop producing data for good.
Similar to getPeer, but returns an address describing this side of the connection.
Returns | An IAddress provider. |
Get the remote address of this connection.
Treat this method with caution. It is the unfortunate result of the CGI and Jabber standards, but should not be considered reliable for the usual host of reasons; port forwarding, proxying, firewalls, IP masquerading, etc.
Returns | An IAddress provider. |