MCPcopy Create free account
hub / github.com/ipython/ipython / system_piped

Method system_piped

IPython/core/interactiveshell.py:2454–2475  ·  view source on GitHub ↗

Call the given cmd in a subprocess, piping stdout/err Parameters ---------- cmd : str Command to execute (can not end in '&', as background processes are not supported. Should not be a command that expects input other than simple text.

(self, cmd)

Source from the content-addressed store, hash-verified

2452 #-------------------------------------------------------------------------
2453
2454 def system_piped(self, cmd):
2455 """Call the given cmd in a subprocess, piping stdout/err
2456
2457 Parameters
2458 ----------
2459 cmd : str
2460 Command to execute (can not end in '&', as background processes are
2461 not supported. Should not be a command that expects input
2462 other than simple text.
2463 """
2464 if cmd.rstrip().endswith('&'):
2465 # this is *far* from a rigorous test
2466 # We do not support backgrounding processes because we either use
2467 # pexpect or pipes to read from. Users can always just call
2468 # os.system() or use ip.system=ip.system_raw
2469 # if they really want a background process.
2470 raise OSError("Background processes not supported.")
2471
2472 # we explicitly do NOT return the subprocess status code, because
2473 # a non-None value would trigger :func:`sys.displayhook` calls.
2474 # Instead, we store the exit_code in user_ns.
2475 self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1))
2476
2477 def system_raw(self, cmd):
2478 """Call the given cmd in a subprocess using os.system on Windows or

Callers

nothing calls this directly

Calls 2

var_expandMethod · 0.95
systemFunction · 0.90

Tested by

no test coverage detected