Package twisted :: Package internet :: Module win32eventreactor :: Class Process |
[frames | no frames]

## Class Process

     Ephemeral --+
                 |
        Logger --+
                 |
    FileDescriptor --+
                     |
                    Process

A process that integrates with the Twisted event loop.

Issues:

- stdin close is actually signalled by process shutdown, which is wrong. Solution is to register stdin pipe with event loop and check for the correct event type - this needs to be implemented.

If your subprocess is a python program, you need to:

- Run python.exe with the '-u' command line option - this turns on unbuffered I/O. Buffering stdout/err/in can cause problems, see e.g. http://support.microsoft.com/default.aspx?scid=kb;EN-US;q1903
- If you don't want Windows messing with data passed over stdin/out/err, set the pipes to be in binary mode:

      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)

Method Summary
| `__init__(self, reactor, protocol, command, args, environment, path)`
| `_closeStdin(self)`
| `closeStderr(self)`
| ``closeStdin`(self)` Close the process' stdin.
| `closeStdout(self)`
| ``connectionLost`(self, reason)` Shut down resources.
| ``connectionLostNotify`(self)` Will be called 3 times, by stdout/err threads and process handle.
| ``doReadErr`(self)` Runs in thread.
| ``doReadOut`(self)` Runs in thread.
| ``doWrite`(self)` Runs in thread.
| `errConnectionLost(self)`
| `inConnectionLost(self)`
| ``loseConnection`(self)` Close the process' stdout, in and err.
| `outConnectionLost(self)`
| `signalProcess(self, signalID)`
| ``write`(self, data)` Write data to the process' stdin.
Inherited from FileDescriptor
| ``_postLoseConnection`(self)` Called after a loseConnection(), when all data has been written.
| ``fileno`(self)` File Descriptor number for select().
| ``pauseProducing`(self)`
| ``registerProducer`(self, producer, streaming)` Register to receive data from a producer.
| ``resumeProducing`(self)`
| ``startReading`(self)` Start waiting for read availability.
| ``startWriting`(self)` Start waiting for write availability.
| ``stopConsuming`(self)` Stop consuming data.
| ``stopProducing`(self)`
| ``stopReading`(self)` Stop waiting for read availability.
| ``stopWriting`(self)` Stop waiting for write availability.
| ``unregisterProducer`(self)` Stop consuming data from a producer, without disconnecting.
| ``writeSequence`(self, iovec)`
| ``writeSomeData`(self, data)` Write as much as possible of the given data, immediately.
Inherited from Logger
| ``logPrefix`(self)` Override this method to insert custom logging behavior.
Inherited from Ephemeral
| ``__getstate__`(self)`
| ``__setstate__`(self, state)`

Class Variable Summary
`str` | `buffer` = `''`
Inherited from FileDescriptor
`tuple` | `__implements__` = `(<class twisted.internet.interfaces.IPr...`
`int` | `bufferSize` = 65536
`int` | `connected` = 0
`str` | `dataBuffer` = `''`
`int` | `disconnected` = 0
`int` | `disconnecting` = 0
`int` | `offset` = 0
`NoneType` | `producer` = None
`int` | `producerPaused` = 0
`int` | `streamingProducer` = 0

Method Details

### closeStdin(self) Close the process' stdin.

### connectionLost(self, reason=None) Shut down resources. Overrides: `twisted.internet.abstract.FileDescriptor.connectionLost`

### connectionLostNotify(self) Will be called 3 times, by stdout/err threads and process handle.

### doReadErr(self) Runs in thread.

### doReadOut(self) Runs in thread.

### doWrite(self) Runs in thread. Overrides: `twisted.internet.abstract.FileDescriptor.doWrite`

### loseConnection(self) Close the process' stdout, in and err. Overrides: `twisted.internet.abstract.FileDescriptor.loseConnection`

### write(self, data) Write data to the process' stdin. Overrides: `twisted.internet.abstract.FileDescriptor.write`

Class Variable Details

    ### buffer Type: `str` Value:
        ''

Generated by Epydoc 2.0 on Sat Oct 25 00:54:50 2003 | http://epydoc.sf.net