Go to the latest version of this document.

# ``twisted`.`internet`.`process``

module documentation
(source)

UNIX Process management.

Do NOT use this module directly - use reactor.spawnProcess() instead.

Maintainer: Itamar Shtull-Trauring

Class | `Process` | An operating-system Process.
Class | `ProcessReader` | ProcessReader
Class | `ProcessWriter` | (Internal) Helper class to write into a Process's input pipe.
Class | `PTYProcess` | An operating-system Process that uses PTY support.
Function | `reapAllProcesses` | Reap all registered processes.
Function | `registerReapProcessHandler` | Register a process handler for the given pid, in case `reapAllProcesses` is called.
Function | `unregisterReapProcessHandler` | Unregister a process handler previously registered with `registerReapProcessHandler`.
Variable | `detector` | Undocumented
Variable | `reapProcessHandlers` | Undocumented
Class | `_BaseProcess` | Base class for Process and PTYProcess.
Class | `_FDDetector` | This class contains the logic necessary to decide which of the available system techniques should be used to detect the open file descriptors for the current process. The chosen technique gets monkey-patched into the _listOpenFDs method of this class so that the detection only needs to occur once.
Function | `_getFileActions` | Get the `file_actions` parameter for `posix_spawn` based on the parameters describing the current process state.
Function | `_listOpenFDs` | Use the global detector object to figure out which FD implementation to use.
Variable | `_PS_CLOSE` | Undocumented
Variable | `_PS_DUP2` | Undocumented

def reapAllProcesses(): (source)

Reap all registered processes.

def registerReapProcessHandler(pid, process): (source)

Register a process handler for the given pid, in case `reapAllProcesses` is called.

Parameters
pid | the pid of the process.
process | a process handler.

def unregisterReapProcessHandler(pid, process): (source)

Unregister a process handler previously registered with `registerReapProcessHandler`.

detector = (source)

Undocumented

reapProcessHandlers: `dict[int, _BaseProcess]` = (source)

Undocumented

def _getFileActions(fdState: `list[tuple[int, bool]]`, childToParentFD: `dict[int, int]`, doClose: `int`, doDup2: `int`) -> `list[tuple[int, ...]]`: (source)

Get the `file_actions` parameter for `posix_spawn` based on the parameters describing the current process state.

Parameters
fdState:`list[tuple[int, bool]]` | A list of 2-tuples of (file descriptor, close-on-exec flag).
childToParentFD:`dict[int, int]` | Undocumented
doClose:`int` | the integer to use for the 'close' instruction
doDup2:`int` | the integer to use for the 'dup2' instruction

Returns
`list[tuple[int, ...]]` | Undocumented

def _listOpenFDs(): (source)

Use the global detector object to figure out which FD implementation to use.

_PS_CLOSE: `int` = (source)

Undocumented

_PS_DUP2: `int` = (source)

Undocumented