| 94 | |
| 95 | |
| 96 | def CppLintWorker(command): |
| 97 | try: |
| 98 | process = subprocess.Popen(command, stderr=subprocess.PIPE) |
| 99 | process.wait() |
| 100 | out_lines = "" |
| 101 | error_count = -1 |
| 102 | while True: |
| 103 | out_line = decode(process.stderr.readline()) |
| 104 | if out_line == '' and process.poll() is not None: |
| 105 | if error_count == -1: |
| 106 | print("Failed to process %s" % command.pop()) |
| 107 | return 1 |
| 108 | break |
| 109 | if out_line.strip() == 'Total errors found: 0': |
| 110 | out_lines += "Done processing %s\n" % command.pop() |
| 111 | error_count += 1 |
| 112 | else: |
| 113 | m = LINT_OUTPUT_PATTERN.match(out_line) |
| 114 | if m: |
| 115 | out_lines += out_line |
| 116 | error_count += 1 |
| 117 | sys.stdout.write(out_lines) |
| 118 | return error_count |
| 119 | except KeyboardInterrupt: |
| 120 | process.kill() |
| 121 | except: |
| 122 | print('Error running cpplint.py. Please make sure you have depot_tools' + |
| 123 | ' in your third_party directory. Lint check skipped.') |
| 124 | process.kill() |
| 125 | |
| 126 | def ClangFormatWorker(command): |
| 127 | try: |