Call args in a subprocess and display output on the fly if ``trace`` is True. Return a tuple of (returncode, stdout, stderr)
(args, verbose=TRACE)
| 2138 | |
| 2139 | |
| 2140 | def call(args, verbose=TRACE): |
| 2141 | """ |
| 2142 | Call args in a subprocess and display output on the fly if ``trace`` is True. |
| 2143 | Return a tuple of (returncode, stdout, stderr) |
| 2144 | """ |
| 2145 | if TRACE_DEEP: |
| 2146 | print("Calling:", " ".join(args)) |
| 2147 | with subprocess.Popen( |
| 2148 | args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8" |
| 2149 | ) as process: |
| 2150 | stdouts = [] |
| 2151 | while True: |
| 2152 | line = process.stdout.readline() |
| 2153 | if not line and process.poll() is not None: |
| 2154 | break |
| 2155 | stdouts.append(line) |
| 2156 | if verbose: |
| 2157 | print(line.rstrip(), flush=True) |
| 2158 | |
| 2159 | stdout, stderr = process.communicate() |
| 2160 | if not stdout.strip(): |
| 2161 | stdout = "\n".join(stdouts) |
| 2162 | return process.returncode, stdout, stderr |
| 2163 | |
| 2164 | |
| 2165 | def download_wheels_with_pip( |
no test coverage detected