MCPcopy Index your code
hub / github.com/python/cpython / _read_cmd_output

Function _read_cmd_output

Lib/_aix_support.py:8–23  ·  view source on GitHub ↗

Output from successful command execution or None

(commandstring, capture_stderr=False)

Source from the content-addressed store, hash-verified

6
7# Taken from _osx_support _read_output function
8def _read_cmd_output(commandstring, capture_stderr=False):
9 """Output from successful command execution or None"""
10 # Similar to os.popen(commandstring, "r").read(),
11 # but without actually using os.popen because that
12 # function is not usable during python bootstrap.
13 import os
14 import contextlib
15 fp = open("/tmp/_aix_support.%s"%(
16 os.getpid(),), "w+b")
17
18 with contextlib.closing(fp) as fp:
19 if capture_stderr:
20 cmd = "%s >'%s' 2>&1" % (commandstring, fp.name)
21 else:
22 cmd = "%s 2>/dev/null >'%s'" % (commandstring, fp.name)
23 return fp.read() if not os.system(cmd) else None
24
25
26def _aix_tag(vrtl, bd):

Callers 1

_aix_bos_rteFunction · 0.85

Calls 2

openFunction · 0.70
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…