mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
fix
This commit is contained in:
parent
93e493afd0
commit
ca3b57a6ed
1 changed files with 14 additions and 8 deletions
|
@ -1021,19 +1021,25 @@ def cmds_to_specs(cmds, captured=False, envs=None):
|
|||
|
||||
# Apply boundary conditions
|
||||
if not XSH.env.get("XONSH_CAPTURE_ALWAYS"):
|
||||
# Make sure sub-specs are always captured.
|
||||
# I.e. ![some_alias | grep x] $(some_alias)
|
||||
specs_to_capture = specs if captured in STDOUT_CAPTURE_KINDS else specs[:-1]
|
||||
for spec in specs_to_capture:
|
||||
if spec.env is None:
|
||||
spec.env = {"XONSH_CAPTURE_ALWAYS": True}
|
||||
else:
|
||||
spec.env.setdefault("XONSH_CAPTURE_ALWAYS", True)
|
||||
# Make sure sub-specs are always captured in case:
|
||||
# `![some_alias | grep x]`, `$(some_alias)`, `some_alias > file`.
|
||||
last = spec
|
||||
specs_to_capture = specs if captured in STDOUT_CAPTURE_KINDS or last.stdout else specs[:-1]
|
||||
_set_specs_capture_always(specs_to_capture)
|
||||
|
||||
_update_last_spec(specs[-1])
|
||||
return specs
|
||||
|
||||
|
||||
def _set_specs_capture_always(specs_to_capture):
|
||||
"""Set XONSH_CAPTURE_ALWAYS for all specs."""
|
||||
for spec in specs_to_capture:
|
||||
if spec.env is None:
|
||||
spec.env = {"XONSH_CAPTURE_ALWAYS": True}
|
||||
else:
|
||||
spec.env.setdefault("XONSH_CAPTURE_ALWAYS", True)
|
||||
|
||||
|
||||
def _shell_set_title(cmds):
|
||||
if XSH.env.get("XONSH_INTERACTIVE") and XSH.shell is not None:
|
||||
# context manager updates the command information that gets
|
||||
|
|
Loading…
Add table
Reference in a new issue