@@ -72,6 +72,91 @@ def __init__(self, output: str, *args: object) -> None:
7272class SubprocessCommand (SkipDefaultFieldsReprMixin ):
7373 """Wraps a :mod:`subprocess` request. Inspect, mutate, control before invocation.
7474
75+ Fields mirror the parameters of :class:`subprocess.Popen`. Each is passed
76+ through as-is when :meth:`Popen`, :meth:`run`, :meth:`check_call`, or
77+ :meth:`check_output` fires, and the defaults match the ones
78+ :mod:`subprocess` uses.
79+
80+ Attributes
81+ ----------
82+ args : _CMD
83+ Program and its arguments, as a sequence like ``['echo', 'hi']`` or
84+ as a single string when ``shell`` is set.
85+ bufsize : int
86+ Buffering policy for the pipe file objects: ``-1`` for
87+ :data:`io.DEFAULT_BUFFER_SIZE`, ``0`` for unbuffered, ``1`` for line
88+ buffered in text mode.
89+ executable : StrOrBytesPath | None
90+ Program to execute in place of ``args[0]``, or the shell to use when
91+ ``shell`` is set. ``None`` runs ``args[0]`` itself.
92+ stdin : _FILE
93+ Child's standard input: a file descriptor, a file object,
94+ :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, or ``None`` to
95+ inherit the parent's.
96+ stdout : _FILE
97+ Child's standard output, taking the same values as ``stdin``.
98+ stderr : _FILE
99+ Child's standard error, taking the same values as ``stdin``, plus
100+ :data:`subprocess.STDOUT` to fold it into ``stdout``.
101+ preexec_fn : t.Callable[[], t.Any] | None
102+ POSIX-only callable run in the child between fork and exec, or
103+ ``None`` to run nothing.
104+ close_fds : bool
105+ Close inherited file descriptors above stderr in the child before
106+ exec.
107+ shell : bool
108+ Run ``args`` through the system shell instead of exec'ing it
109+ directly.
110+ cwd : StrOrBytesPath | None
111+ Directory to change into before running, or ``None`` to inherit the
112+ parent's working directory.
113+ env : _ENV | None
114+ Environment for the child, replacing the parent's, or ``None`` to
115+ inherit it.
116+ creationflags : int
117+ Windows-only process creation flags, e.g.
118+ :data:`subprocess.CREATE_NEW_CONSOLE`. ``0`` applies none.
119+ startupinfo : t.Any | None
120+ Windows-only :class:`subprocess.STARTUPINFO` controlling how the
121+ child's window appears, or ``None`` for the defaults.
122+ restore_signals : bool
123+ POSIX-only: reset signals Python set to ``SIG_IGN`` back to
124+ ``SIG_DFL`` in the child before exec.
125+ start_new_session : bool
126+ POSIX-only: run :func:`os.setsid` in the child, detaching it from the
127+ parent's process group and controlling terminal.
128+ pass_fds : t.Any
129+ POSIX-only file descriptors to keep open in the child regardless of
130+ ``close_fds``. The empty ``()`` passes none.
131+ umask : int
132+ POSIX-only umask to apply in the child before exec. ``-1`` leaves the
133+ inherited umask alone.
134+ pipesize : int
135+ Capacity of the pipes opened for ``stdin``, ``stdout``, and
136+ ``stderr``. ``-1`` keeps the operating system default.
137+ user : str | None
138+ POSIX-only user to switch the child to, or ``None`` to stay as the
139+ calling user.
140+ group : str | None
141+ POSIX-only group to switch the child to, or ``None`` to keep the
142+ calling group.
143+ extra_groups : list[str] | None
144+ POSIX-only supplementary groups for the child, or ``None`` to leave
145+ them untouched.
146+ universal_newlines : bool | None
147+ Alias of ``text``, kept for backwards compatibility. ``None`` leaves
148+ the mode to the other text options.
149+ text : t.Literal[True] | None
150+ Open the pipe file objects in text mode. ``None`` leaves them binary
151+ unless ``encoding``, ``errors``, or ``universal_newlines`` selects
152+ text.
153+ encoding : str | None
154+ Codec for the text-mode pipe file objects. Setting it turns text mode
155+ on; ``None`` leaves the choice to the other text options.
156+ errors : str | None
157+ Decoding error handler for the text-mode pipe file objects, e.g.
158+ ``"replace"``. Setting it turns text mode on.
159+
75160 Examples
76161 --------
77162 >>> cmd = SubprocessCommand("ls")
0 commit comments