Move note about last subprocess (#5592)

Move the note about the last subprocess and return code to the section on Running Commands.

When found only in the 'Captured Subprocess' section, it implies that the behavior is only available for captured subprocesses, when in fact it's available for any command. This bit could have gone into its own section, but since it's already carved out as a 'Note', it seems fine to put it here in the Running Commands section.

Closes #5591
This commit is contained in:
Jason R. Coombs 2024-07-11 00:27:05 -04:00 committed by GitHub
parent 2142a7b85e
commit 247ecba38a
Failed to generate hash of commit

View file

@ -276,6 +276,11 @@ Running subprocess commands should work like in any other shell.
This should feel very natural. This should feel very natural.
.. note::
Access the last run subprocess command using ``__xonsh__.last``;
e.g. to get the return code, run ``__xonsh__.last.rtn``.
Python-mode vs Subprocess-mode Python-mode vs Subprocess-mode
================================ ================================
@ -371,11 +376,6 @@ For example,
line characters. You can set ``$XONSH_SUBPROC_OUTPUT_FORMAT`` to ``list_lines`` line characters. You can set ``$XONSH_SUBPROC_OUTPUT_FORMAT`` to ``list_lines``
to have a list of distinct lines in the commands like ``du -h $(ls)``. to have a list of distinct lines in the commands like ``du -h $(ls)``.
.. note::
You can access a subprocess command you ran using ``__xonsh__.last``
e.g. to get the return code run ``__xonsh__.last.rtn``.
The ``!()`` syntax captured more information about the command, as an instance The ``!()`` syntax captured more information about the command, as an instance
of a class called ``CommandPipeline``. This object contains more information of a class called ``CommandPipeline``. This object contains more information