diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 573b438..6312236 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -2210,7 +2210,7 @@ class InteractiveShell(SingletonConfigurable): # use piped system by default, because it is better behaved system = system_piped - def getoutput(self, cmd, split=True): + def getoutput(self, cmd, split=True, _depth=0): """Get output (possibly including stderr) from a subprocess. Parameters @@ -2229,7 +2229,7 @@ class InteractiveShell(SingletonConfigurable): if cmd.rstrip().endswith('&'): # this is *far* from a rigorous test raise OSError("Background processes not supported.") - out = getoutput(self.var_expand(cmd, depth=1)) + out = getoutput(self.var_expand(cmd, depth=_depth+1)) if split: out = SList(out.splitlines()) else: diff --git a/IPython/testing/globalipapp.py b/IPython/testing/globalipapp.py index 82f752c..4f4807f 100644 --- a/IPython/testing/globalipapp.py +++ b/IPython/testing/globalipapp.py @@ -98,7 +98,7 @@ def xsys(self, cmd): """ # We use getoutput, but we need to strip it because pexpect captures # the trailing newline differently from commands.getoutput - print(self.getoutput(cmd, split=False).rstrip(), end='', file=sys.stdout) + print(self.getoutput(cmd, split=False, _depth=1).rstrip(), end='', file=sys.stdout) sys.stdout.flush()