| 6874 | return child == os.path.join(prefix, child_suffix) |
| 6875 | |
| 6876 | def main(): |
| 6877 | filenames = ParseArguments(sys.argv[1:]) |
| 6878 | backup_err = sys.stderr |
| 6879 | try: |
| 6880 | # Change stderr to write with replacement characters so we don't die |
| 6881 | # if we try to print something containing non-ASCII characters. |
| 6882 | sys.stderr = codecs.StreamReader(sys.stderr, 'replace') |
| 6883 | |
| 6884 | _cpplint_state.ResetErrorCounts() |
| 6885 | for filename in filenames: |
| 6886 | ProcessFile(filename, _cpplint_state.verbose_level) |
| 6887 | # If --quiet is passed, suppress printing error count unless there are errors. |
| 6888 | if not _cpplint_state.quiet or _cpplint_state.error_count > 0: |
| 6889 | _cpplint_state.PrintErrorCounts() |
| 6890 | |
| 6891 | if _cpplint_state.output_format == 'junit': |
| 6892 | sys.stderr.write(_cpplint_state.FormatJUnitXML()) |
| 6893 | |
| 6894 | finally: |
| 6895 | sys.stderr = backup_err |
| 6896 | |
| 6897 | sys.exit(_cpplint_state.error_count > 0) |
| 6898 | |
| 6899 | |
| 6900 | if __name__ == '__main__': |