From 247ecba38af1308f60bff4bc50c2eae4d0ff3bab Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 11 Jul 2024 00:27:05 -0400 Subject: [PATCH] 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 --- docs/tutorial.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 88be20bf9..30cf8a1ea 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -276,6 +276,11 @@ Running subprocess commands should work like in any other shell. 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 ================================ @@ -371,11 +376,6 @@ For example, 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)``. -.. 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 of a class called ``CommandPipeline``. This object contains more information