Output from successful command execution or None
(commandstring, capture_stderr=False)
| 6 | |
| 7 | # Taken from _osx_support _read_output function |
| 8 | def _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 | |
| 26 | def _aix_tag(vrtl, bd): |
no test coverage detected
searching dependent graphs…