Return (return-code, stdout, stderr).
(command)
| 99 | |
| 100 | |
| 101 | def run(command): |
| 102 | """Return (return-code, stdout, stderr).""" |
| 103 | shell = True if type(command) is str else False |
| 104 | p = subprocess.Popen( |
| 105 | command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell |
| 106 | ) |
| 107 | raw_output, raw_err = p.communicate() |
| 108 | rc = p.returncode |
| 109 | if get_platform() == "win32": |
| 110 | enc = "oem" |
| 111 | else: |
| 112 | enc = locale.getpreferredencoding() |
| 113 | output = raw_output.decode(enc) |
| 114 | err = raw_err.decode(enc) |
| 115 | return rc, output.strip(), err.strip() |
| 116 | |
| 117 | |
| 118 | def run_and_read_all(run_lambda, command): |
nothing calls this directly
no test coverage detected