Subprocess POSIX Runners (xonsh.procs.posix
)¶
Interface for running subprocess-mode commands on posix systems.
-
class
xonsh.procs.posix.
PopenThread
(*args, stdin=None, stdout=None, stderr=None, **kwargs)[source]¶ A thread for running and managing subprocess. This allows reading from the stdin, stdout, and stderr streams in a non-blocking fashion.
This takes the same arguments and keyword arguments as regular Popen. This requires that the captured_stdout and captured_stderr attributes to be set following instantiation.
This constructor should always be called with keyword arguments. Arguments are:
group should be None; reserved for future extension when a ThreadGroup class is implemented.
target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.
name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.
args is the argument tuple for the target invocation. Defaults to ().
kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.
If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.
-
run
()[source]¶ Runs the subprocess by performing a parallel read on stdin if allowed, and copying bytes from captured_stdout to stdout and bytes from captured_stderr to stderr.
-
wait
(timeout=None)[source]¶ Dispatches to Popen.wait(), but also does process cleanup such as joining this thread and replacing the original window size signal handler.
-
property
returncode
¶ Process return code.
-
property
signal
¶ Process signal, or None.
-