class twisted.internet.process.PTYProcess(abstract.FileDescriptor, _BaseProcess): (source)
Implements interfaces: twisted.internet.interfaces.IProcessTransport
An operating-system Process that uses PTY support.
Instance Variable | status | Undocumented |
Class Variable | pid | From before IProcessProtocol.makeConnection is called to before IProcessProtocol.processEnded is called, pid is an int giving the platform process ID of this process. pid is None at all other times. |
Method | __init__ | Spawn an operating-system process. |
Instance Variable | fd | Undocumented |
Instance Variable | connected | Undocumented |
Method | closeStdin | Close stdin after all data has been written out. |
Method | closeStdout | Close stdout. |
Method | closeStderr | Close stderr. |
Method | doRead | Called when my standard output stream is ready for reading. |
Method | fileno | This returns the file number of standard output on this process. |
Method | maybeCallProcessEnded | Call processEnded on protocol after final cleanup. |
Method | connectionLost | I call this to clean up when one or all of my connections has died. |
Method | writeSomeData | Write some data to the open process. |
Method | closeChildFD | Close a file descriptor which is connected to the child process, identified by its FD in the child process. |
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 | _setupChild | Set up child process after fork() but before exec() . |
Inherited from FileDescriptor:
Instance Variable | disconnected | Undocumented |
Instance Variable | disconnecting | Undocumented |
Instance Variable | dataBuffer | Undocumented |
Instance Variable | offset | Undocumented |
Class Variable | SEND_LIMIT | Undocumented |
Instance Variable | reactor | Undocumented |
Instance Variable | producer | Undocumented |
Method | doWrite | Called when data can be written. |
Instance Variable | producerPaused | Undocumented |
Method | writeConnectionLost | Undocumented |
Method | readConnectionLost | Undocumented |
Method | getHost | Undocumented |
Method | getPeer | Undocumented |
Method | write | Reliably write some data. |
Method | writeSequence | Reliably write a sequence of data. |
Method | loseConnection | Close the connection at the next available opportunity. |
Method | loseWriteConnection | Undocumented |
Method | stopReading | Stop waiting for read availability. |
Method | stopWriting | Stop waiting for write availability. |
Method | startReading | Start waiting for read availability. |
Method | startWriting | Start waiting for write availability. |
Class Variable | bufferSize | Undocumented |
Method | stopConsuming | Stop consuming data. |
Method | resumeProducing | Undocumented |
Method | pauseProducing | Undocumented |
Method | stopProducing | Undocumented |
Instance Variable | _writeDisconnecting | Undocumented |
Instance Variable | _writeDisconnected | Undocumented |
Instance Variable | _tempDataBuffer | Undocumented |
Instance Variable | _tempDataLen | Undocumented |
Method | _postLoseConnection | Called after a loseConnection(), when all data has been written. |
Method | _closeWriteConnection | Undocumented |
Method | _isSendBufferFull | Determine whether the user-space send buffer for this transport is full or not. |
Method | _maybePauseProducer | Possibly pause a producer, if there is one and the send buffer is full. |
Inherited from _ConsumerMixin (via FileDescriptor):
Instance Variable | streamingProducer | bool or int |
Method | registerProducer | Register to receive data from a producer. |
Method | unregisterProducer | Stop consuming data from a producer, without disconnecting. |
Inherited from _LogOwner (via FileDescriptor):
Method | logPrefix | Override this method to insert custom logging behavior. Its return value will be inserted in front of every line. It may be called more times than the number of output lines. |
Method | _getLogPrefix | Determine the log prefix to use for messages related to applicationObject , which may or may not be an interfaces.ILoggingContext provider. |
Inherited from _BaseProcess:
Method | reapProcess | Try to reap a process (without blocking) via waitpid. |
Method | signalProcess | No summary |
Method | __repr__ | String representation of a process. |
Method | _getReason | Undocumented |
Method | _resetSignalDisposition | Undocumented |
Method | _fork | Fork and then exec sub-process. |
Method | _execChild | The exec() which is done in the forked child. |
Inherited from BaseProcess (via _BaseProcess):
Class Variable | lostProcess | Undocumented |
Instance Variable | proto | Undocumented |
Method | processEnded | This is called when the child terminates. |
Method | _callProcessExited | Undocumented |
From before IProcessProtocol.makeConnection
is called to before IProcessProtocol.processEnded
is called, pid
is an int
giving the platform process ID of this process. pid
is None
at all other times.
Spawn an operating-system process.
This is where the hard work of disconnecting all currently open files / forking / executing the new process happens. (This is executed automatically when a Process is instantiated.)
This will also run the subprocess as a given user ID and group ID, if specified. (Implementation Note: this doesn't support all the arcane nuances of setXXuid on UNIX: it will assume that either your effective or real UID is 0.)
Set up child process after fork()
but before exec()
.
This involves:
masterfd
, since it is not used in the subprocessos.setsid
slavefd
slavefd
to standard input, output, and error_listOpenFDs
)SIG_DFL
Parameters | masterfd | The master end of a PTY file descriptors opened with openpty . (type: int ) |
slavefd | The slave end of a PTY opened with openpty . (type: int ) |
I call this to clean up when one or all of my connections has died.
Close a file descriptor which is connected to the child process, identified by its FD in the child process.
Similar to ITransport.write
but also allows the file descriptor in the child process which will receive the bytes to be specified.
Parameters | childFD | The file descriptor to which to write. |
data | The bytes to write. | |
Raises | KeyError | If childFD is not a file descriptor that was mapped in the child when IReactorProcess.spawnProcess was used to create it. |