Public Member Functions | |
def | __init__ |
def | initialize |
def | set_exit_callback |
def | uninitialize |
Public Attributes | |
io_loop | |
proc | |
returncode | |
stderr | |
stdin | |
stdout | |
Static Public Attributes | |
tuple | STREAM = object() |
Private Member Functions | |
def | _cleanup |
def | _set_returncode |
def | _try_cleanup_process |
Private Attributes | |
_exit_callback | |
Static Private Attributes | |
_initialized = False | |
dictionary | _waiting = {} |
Wraps ``subprocess.Popen`` with IOStream support. The constructor is the same as ``subprocess.Popen`` with the following additions: * ``stdin``, ``stdout``, and ``stderr`` may have the value ``tornado.process.Subprocess.STREAM``, which will make the corresponding attribute of the resulting Subprocess a `.PipeIOStream`. * A new keyword argument ``io_loop`` may be used to pass in an IOLoop.
Definition at line 184 of file process.py.
def tornado.process.Subprocess.__init__ | ( | self, | |
args, | |||
kwargs | |||
) |
Definition at line 200 of file process.py.
def tornado.process.Subprocess._cleanup | ( | cls | ) | [private] |
Definition at line 285 of file process.py.
def tornado.process.Subprocess._set_returncode | ( | self, | |
status | |||
) | [private] |
Definition at line 303 of file process.py.
def tornado.process.Subprocess._try_cleanup_process | ( | cls, | |
pid | |||
) | [private] |
Definition at line 290 of file process.py.
def tornado.process.Subprocess.initialize | ( | cls, | |
io_loop = None |
|||
) |
Initializes the ``SIGCHILD`` handler. The signal handler is run on an `.IOLoop` to avoid locking issues. Note that the `.IOLoop` used for signal handling need not be the same one used by individual Subprocess objects (as long as the ``IOLoops`` are each running in separate threads).
Definition at line 259 of file process.py.
def tornado.process.Subprocess.set_exit_callback | ( | self, | |
callback | |||
) |
Runs ``callback`` when this process exits. The callback takes one argument, the return code of the process. This method uses a ``SIGCHILD`` handler, which is a global setting and may conflict if you have other libraries trying to handle the same signal. If you are using more than one ``IOLoop`` it may be necessary to call `Subprocess.initialize` first to designate one ``IOLoop`` to run the signal handlers. In many cases a close callback on the stdout or stderr streams can be used as an alternative to an exit callback if the signal handler is causing a problem.
Definition at line 238 of file process.py.
def tornado.process.Subprocess.uninitialize | ( | cls | ) |
Removes the ``SIGCHILD`` handler.
Definition at line 277 of file process.py.
Definition at line 200 of file process.py.
tornado::process.Subprocess::_initialized = False [static, private] |
Definition at line 197 of file process.py.
dictionary tornado::process.Subprocess::_waiting = {} [static, private] |
Definition at line 198 of file process.py.
Definition at line 200 of file process.py.
Definition at line 200 of file process.py.
Definition at line 200 of file process.py.
Definition at line 200 of file process.py.
Definition at line 200 of file process.py.
Definition at line 200 of file process.py.
tuple tornado::process.Subprocess::STREAM = object() [static] |
Definition at line 195 of file process.py.