Tee’d Psuedo-Terminal (xonsh.teepty
)¶
This implements a psuedo-TTY that tees its output into a Python buffer.
This file was forked from a version distibuted under an MIT license and Copyright (c) 2011 Joshua D. Bartlett. See http://sqizit.bartletts.id.au/2011/02/14/pseudo-terminals-in-python/ for more information.
-
class
xonsh.teepty.
TeePTY
(bufsize=1024, remove_color=True, encoding='utf-8', errors='strict')[source]¶ This class is a pseudo terminal that tees the stdout and stderr into a buffer.
Parameters: bufsize : int, optional
The buffer size to read from the root terminal to/from the tee’d terminal.
remove_color : bool, optional
Removes color codes from the tee’d buffer, though not the TTY.
encoding : str, optional
The encoding to use when decoding into a str.
errors : str, optional
The encoding error flag to use when decoding into a str.
-
spawn
(argv=None, env=None, stdin=None, delay=None)[source]¶ Create a spawned process. Based on the code for pty.spawn(). This cannot be used except from the main thread.
Parameters: argv : list of str, optional
Arguments to pass in as subprocess. In None, will execute $SHELL.
env : Mapping, optional
Environment to pass execute in.
delay : float, optional
Delay timing before executing process if piping in data. The value is passed into time.sleep() so it is in [seconds]. If delay is None, its value will attempted to be looked up from the environment variable $TEEPTY_PIPE_DELAY, from the passed in env or os.environ. If not present or not positive valued, no delay is used.
Returns: wcode : int
Return code for the spawned process encoded as os.wait format.
-