mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
wip
This commit is contained in:
parent
71ab4d2aeb
commit
c9d87ab9b5
2 changed files with 24 additions and 21 deletions
|
@ -1186,9 +1186,11 @@ The file should contain a function with the signature
|
|||
" - ptk style name (string) - ``$XONSH_STYLE_OVERRIDES['pygments.keyword'] = '#ff0000'``\n\n"
|
||||
"(The rules above are all have the same effect.)",
|
||||
)
|
||||
XONSH_TRACE_SUBPROC = Var.with_default(
|
||||
False,
|
||||
"Set to ``True`` to show arguments list of every executed subprocess command.",
|
||||
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.",
|
||||
)
|
||||
XONSH_TRACE_COMPLETIONS = Var.with_default(
|
||||
False,
|
||||
|
|
|
@ -887,28 +887,29 @@ def run_subproc(cmds, captured=False, envs=None):
|
|||
|
||||
specs = cmds_to_specs(cmds, captured=captured, envs=envs)
|
||||
|
||||
if XSH.env.get("XONSH_TRACE_SUBPROC", False):
|
||||
tracer = XSH.env.get("XONSH_TRACE_SUBPROC_FUNC")
|
||||
if (trace := 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)
|
||||
for i, s in enumerate(specs):
|
||||
pcls = s.cls.__module__ + "." + s.cls.__name__
|
||||
pcmd = (
|
||||
[s.args[0].__name__] + s.args[1:] if callable(s.args[0]) else s.args
|
||||
)
|
||||
p = {
|
||||
"cmd": pcmd,
|
||||
"cls": pcls,
|
||||
"alias": s.alias_name,
|
||||
"bin": s.binary_loc,
|
||||
"thread": s.threadable,
|
||||
"bg": s.background,
|
||||
}
|
||||
p = {k: v for k, v in p.items() if v is not None}
|
||||
print(f"{i}: {repr(p)}")
|
||||
print(f"Trace run_subproc({repr(r)})", file=sys.stderr)
|
||||
if int(trace) == 2:
|
||||
for i, s in enumerate(specs):
|
||||
pcls = s.cls.__module__ + "." + s.cls.__name__
|
||||
pcmd = (
|
||||
[s.args[0].__name__] + s.args[1:] if callable(s.args[0]) else s.args
|
||||
)
|
||||
p = {
|
||||
"cmd": pcmd,
|
||||
"cls": pcls,
|
||||
"alias": s.alias_name,
|
||||
"bin": s.binary_loc,
|
||||
"thread": s.threadable,
|
||||
"bg": s.background,
|
||||
}
|
||||
p = {k: v for k, v in p.items() if v is not None}
|
||||
print(f"{i}: {repr(p)}")
|
||||
|
||||
cmds = [
|
||||
_flatten_cmd_redirects(cmd) if isinstance(cmd, list) else cmd for cmd in cmds
|
||||
|
|
Loading…
Add table
Reference in a new issue