Home | Trees | Index | Help |
---|
Package pybaz :: Package backends :: Module forkexec :: Class ChildProcess |
|
Description of a child process, for error handling.
Method Summary | |
---|---|
Create a child process descriptor. | |
Fork, setup file descriptors, and exec child process. | |
Wait for process and check its termination status. | |
Wait for process and return exit result. |
Method Details |
---|
__init__(self,
command,
args,
expected=0,
chdir=None,
logger=None)
|
spawn(self, stdout=None, stdin=None, stderr=None, closefds=[])Fork, setup file descriptors, and exec child process. The `stdout`, `stdin` and `stderr` file-like objects can be raw file descriptors (ints) or file-like objects with a ``fileno`` method returning a file descriptor. When building a pipe, one side of a pipe is used as `stdout`, `stdin` or `stderr`, and the other is included in the `closefds` list, so the child process will be able to detect a broken pipe. :param stdin: use as standard input of child process, defaults to ``/dev/null``. :type stdin: file-like object with a ``fileno`` method or raw file descriptor (``int``). :param stdout: use as standard output of child process, defaults to internal pipe or ``/dev/null``. :type stdout: file-like object with a ``fileno`` method or raw file descriptor (``int``). If a logger was specified, defaults to a pipe for logging, if no logger was specified, defaults to ``/dev/null``. :param stderr: use as standard error of child process. Defaults to a pipe for error reporting (see `ExecProblem`) and logging. :type stderr: file-like object with a ``fileno`` method or raw file descriptor (``int``). :param closefds: file descriptors to close in the child process. :type closefds: iterable of int |
wait(self)Wait for process and check its termination status. If the process exited, set ``self.status`` to its exit status. if the process was terminated by a signal, set ``self.signal`` to the value of this signal. :raise ExecProblem: process was killed by a signal or exit status is not is ``self.expected`` |
wait_nocheck(self)Wait for process and return exit result. This (internally used) variant of `wait` is useful when you want to wait for a child process, but not raise an exception if it was terminated abnormally. Typically, that's what you want if you killed the child process. :return: second element of the tuple returned by os.wait() |
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Tue Jul 18 16:30:57 2006 | http://epydoc.sf.net |