Package twisted :: Package internet :: Module win32eventreactor :: Class Process

[show private | hide private]
[frames | no frames]

## Class Process

        Logger --+
                 |
     Ephemeral --+
                 |
    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)`
| `__getstate__(self)` (inherited from `Ephemeral`)
| `__setstate__(self, state)` (inherited from `Ephemeral`)
| `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)`
| ``fileno`(self)` File Descriptor number for select(). (inherited from `FileDescriptor`)
| `inConnectionLost(self)`
| ``logPrefix`(self)` Override this method to insert custom logging behavior. (inherited from `Logger`)
| ``loseConnection`(self)` Close the process' stdout, in and err.
| `outConnectionLost(self)`
| `pauseProducing(self)` (inherited from `FileDescriptor`)
| ``registerProducer`(self, producer, streaming)` Register to receive data from a producer. (inherited from `FileDescriptor`)
| `resumeProducing(self)` (inherited from `FileDescriptor`)
| ``startReading`(self)` Start waiting for read availability. (inherited from `FileDescriptor`)
| ``startWriting`(self)` Start waiting for write availability. (inherited from `FileDescriptor`)
| ``stopConsuming`(self)` Stop consuming data. (inherited from `FileDescriptor`)
| `stopProducing(self)` (inherited from `FileDescriptor`)
| ``stopReading`(self)` Stop waiting for read availability. (inherited from `FileDescriptor`)
| ``stopWriting`(self)` Stop waiting for write availability. (inherited from `FileDescriptor`)
| ``unregisterProducer`(self)` Stop consuming data from a producer, without disconnecting. (inherited from `FileDescriptor`)
| ``write`(self, data)` Write data to the process' stdin.
| `writeSequence(self, iovec)` (inherited from `FileDescriptor`)
| ``writeSomeData`(self, data)` Write as much as possible of the given data, immediately. (inherited from `FileDescriptor`)
| `_closeStdin(self)`
| ``_postLoseConnection`(self)` Called after a loseConnection(), when all data has been written. (inherited from `FileDescriptor`)

Class Variable Summary
`str` | `buffer`

Method Details

### closeStdin(self)

Close the process' stdin.

### connectionLost(self, reason=None)

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.

### loseConnection(self)

Close the process' stdout, in and err.

### write(self, data)

Write data to the process' stdin.

Class Variable Details

### buffer

  Type:
    `str`
  Value:

        ''

Generated by Epydoc 1.1 on Thu May 8 13:18:30 2003 | http://epydoc.sf.net