mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Added `$XONSH_TRACE_SUBPROC=3
` (#5459)
Show std if `$XONSH_TRACE_SUBPROC=3`. ### Motivation * It's very helpful if you want to understand how subproc is working. * It's helpful to trace `SpecModifierAlias`. * It's helpful to trace cases like #2618 ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
a953c29443
commit
aaf3c99a3b
2 changed files with 40 additions and 5 deletions
23
news/trace3.rst
Normal file
23
news/trace3.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* Added mode ``$XONSH_TRACE_SUBPROC=3`` to show more information about pipeline.
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -958,7 +958,7 @@ def _trace_specs(trace_mode, specs, cmds, captured):
|
|||
else:
|
||||
r = {"cmds": cmds, "captured": captured}
|
||||
print(f"Trace run_subproc({repr(r)})", file=sys.stderr)
|
||||
if trace_mode == 2:
|
||||
if trace_mode >= 2:
|
||||
for i, s in enumerate(specs):
|
||||
pcls = s.cls.__module__ + "." + s.cls.__name__
|
||||
pcmd = (
|
||||
|
@ -967,11 +967,23 @@ def _trace_specs(trace_mode, specs, cmds, captured):
|
|||
p = {
|
||||
"cmd": pcmd,
|
||||
"cls": pcls,
|
||||
"alias": s.alias_name,
|
||||
"bin": s.binary_loc,
|
||||
"threadable": s.threadable,
|
||||
"bg": s.background,
|
||||
}
|
||||
p |= {
|
||||
a: getattr(s, a, None)
|
||||
for a in ["alias_name", "binary_loc", "threadable", "background"]
|
||||
}
|
||||
if trace_mode == 3:
|
||||
p |= {
|
||||
a: getattr(s, a, None)
|
||||
for a in [
|
||||
"stdin",
|
||||
"stdout",
|
||||
"stderr",
|
||||
"captured",
|
||||
"captured_stdout",
|
||||
"captured_stderr",
|
||||
]
|
||||
}
|
||||
p = {k: v for k, v in p.items() if v is not None}
|
||||
print(f"{i}: {repr(p)}", file=sys.stderr)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue