File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 2121import typing
2222import warnings
2323from pathlib import Path
24+ from subprocess import CalledProcessError
2425
2526from IPython .core import page
2627from IPython .core .autocall import ZMQExitAutocall
@@ -783,9 +784,14 @@ def system_piped(self, cmd):
783784 with AvoidUNCPath () as path :
784785 if path is not None :
785786 cmd = f"pushd { path } &&{ cmd } "
786- self .user_ns ["_exit_code" ] = system (cmd )
787+ exit_code = system (cmd )
788+ self .user_ns ["_exit_code" ] = exit_code
787789 else :
788- self .user_ns ["_exit_code" ] = system (self .var_expand (cmd , depth = 1 ))
790+ exit_code = system (self .var_expand (cmd , depth = 1 ))
791+ self .user_ns ["_exit_code" ] = exit_code
792+
793+ if getattr (self , "system_raise_on_error" , False ) and exit_code != 0 :
794+ raise CalledProcessError (exit_code , cmd )
789795
790796 # Ensure new system_piped implementation is used
791797 system = system_piped
You can’t perform that action at this time.
0 commit comments