Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -120,23 +120,24 @@ def get_cpp_output(header=header, usedouble=False): · 119 unmodified lines | |||
| 120 | print("Running command: {:s}".format(" ".join(cpp_cmd))) | 120 | print("Running command: {:s}".format(" ".join(cpp_cmd))) |
| 121 | proc = subprocess.Popen(cpp_cmd, | 121 | proc = subprocess.Popen(cpp_cmd, |
| 122 | stderr=subprocess.PIPE, | 122 | stderr=subprocess.PIPE, |
| 123 | stdout=subprocess.PIPE) | 123 | stdout=subprocess.PIPE, |
| 124 | universal_newlines=True) | ||
| 124 | assert proc, 'Proc was none' | 125 | assert proc, 'Proc was none' |
| 125 | cpp_output = proc.stdout.read() | 126 | cpp_output = proc.stdout.read() |
| 126 | err_output = proc.stderr.read() | 127 | err_output = proc.stderr.read() |
| 127 | if err_output: | 128 | if err_output: |
| 128 | print("Warning: preprocessor produced errors or warnings:\n%s" \ | 129 | print("Warning: preprocessor produced errors or warnings:\n%s" \ |
| 129 | % err_output.decode('utf8')) | 130 | % err_output) |
| 130 | if not cpp_output: | 131 | if not cpp_output: |
| 131 | raise_msg = "preprocessor output is empty! Running command " \ | 132 | raise_msg = "preprocessor output is empty! Running command " \ |
| 132 | + "\"%s\" failed" % " ".join(cpp_cmd) | 133 | + "\"%s\" failed" % " ".join(cpp_cmd) |
| 133 | if err_output: | 134 | if err_output: |
| 134 | raise_msg += " with stderr: \"%s\"" % err_output.decode('utf8') | 135 | raise_msg += " with stderr: \"%s\"" % err_output |
| 135 | else: | 136 | else: |
| 136 | raise_msg += " with no stdout or stderr" | 137 | raise_msg += " with no stdout or stderr" |
| 137 | raise Exception(raise_msg) | 138 | raise Exception(raise_msg) |
| 138 | if not isinstance(cpp_output, list): | 139 | if not isinstance(cpp_output, list): |
| 139 | cpp_output = [l.strip() for l in cpp_output.decode('utf8').split('\n')] | 140 | cpp_output = [l.strip() for l in cpp_output.split('\n')] |
| 140 | 141 | ||
| 141 | return cpp_output | 142 | return cpp_output |
| 142 | 143 | ||