This commit is contained in:
a 2024-04-25 22:53:45 +02:00 committed by Noorhteen Raja NJ
parent 52c96c9dd5
commit a769689515
2 changed files with 3 additions and 2 deletions

View file

@ -1188,6 +1188,7 @@ The file should contain a function with the signature
)
XONSH_TRACE_SUBPROC = Var(
default=always_false,
convert=to_bool_or_int,
doc="Set to ``True`` or ``1`` to show arguments list of every executed subprocess command. "
"Use ``2`` to have full specification.",
)

View file

@ -887,14 +887,14 @@ def run_subproc(cmds, captured=False, envs=None):
specs = cmds_to_specs(cmds, captured=captured, envs=envs)
if trace := XSH.env.get("XONSH_TRACE_SUBPROC", False):
if tr := XSH.env.get("XONSH_TRACE_SUBPROC", False):
tracer = XSH.env.get("XONSH_TRACE_SUBPROC_FUNC", None)
if callable(tracer):
tracer(cmds, captured=captured)
else:
r = {"cmds": cmds, "captured": captured}
print(f"Trace run_subproc({repr(r)})", file=sys.stderr)
if int(trace) == 2:
if tr == 2:
for i, s in enumerate(specs):
pcls = s.cls.__module__ + "." + s.cls.__name__
pcmd = (