(cppcheck_path, options)
| 5 | |
| 6 | # TODO: detect missing file |
| 7 | def run(cppcheck_path, options): |
| 8 | cmd = options.split() |
| 9 | cmd.insert(0, cppcheck_path) |
| 10 | print('running {}'.format(cppcheck_path)) |
| 11 | with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) as p: |
| 12 | stdout, stderr = p.communicate() |
| 13 | rc = p.returncode |
| 14 | # only 0 and 1 are well-defined in this case |
| 15 | if rc > 1: |
| 16 | print('error') |
| 17 | return None, None, None |
| 18 | # signals are reported as negative exitcode (e.g. SIGSEGV -> -11) |
| 19 | if rc < 0: |
| 20 | print('crash') |
| 21 | return rc, stderr, stdout |
| 22 | print('done') |
| 23 | return rc, stderr, stdout |
| 24 | |
| 25 | |
| 26 | # TODO: check arguments |
no test coverage detected