properly return terminal in interactive mode when RAISE_SUBPROC_ERROR = True

This commit is contained in:
Anthony Scopatz 2018-06-13 16:19:10 -04:00
parent 8092e02f3b
commit 0131ec54df
2 changed files with 21 additions and 2 deletions

15
news/raisesub.rst Normal file
View file

@ -0,0 +1,15 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fixed issue where xonsh would fail to properly return the terminal prompt
(and eat up 100% CPU) after a failed subprocess command in interactive mode
if ``$RAISE_SUBPROC_ERROR = True``.
**Security:** None

View file

@ -2149,8 +2149,12 @@ class CommandPipeline:
rtn is not None and rtn is not None and
rtn > 0 and rtn > 0 and
builtins.__xonsh_env__.get('RAISE_SUBPROC_ERROR')): builtins.__xonsh_env__.get('RAISE_SUBPROC_ERROR')):
raise subprocess.CalledProcessError(rtn, spec.cmd, try:
output=self.output) raise subprocess.CalledProcessError(rtn, spec.cmd,
output=self.output)
finally:
# this is need to get a working terminal in interactive mode
self._return_terminal()
# #
# Properties # Properties