Skip to content

Commit 75cbe79

Browse files
committed
Write sed output to stdout for ease of piping to bash
Also fix other writes to stdout to be preceeded by #
1 parent 8ea1668 commit 75cbe79

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/cpplint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ def PrintErrorCounts(self):
955955
for category, count in self.errors_by_category.iteritems():
956956
sys.stderr.write('Category \'%s\' errors found: %d\n' %
957957
(category, count))
958-
sys.stdout.write('Total errors found: %d\n' % self.error_count)
958+
sys.stdout.write('Total errors found: %d\n' % self.error_count)
959959

960960
_cpplint_state = _CppLintState()
961961

@@ -1237,7 +1237,7 @@ def Error(filename, linenum, category, confidence, message):
12371237
filename, linenum, message, category, confidence))
12381238
elif _cpplint_state.output_format in ['sed', 'gsed']:
12391239
if message in _SED_FIXUPS:
1240-
sys.stderr.write(_cpplint_state.output_format + " -i '%s%s' %s # %s [%s] [%d]\n" % (
1240+
sys.stdout.write(_cpplint_state.output_format + " -i '%s%s' %s # %s [%s] [%d]\n" % (
12411241
linenum, _SED_FIXUPS[message], filename, message, category, confidence))
12421242
else:
12431243
sys.stderr.write('# %s:%s: "%s" [%s] [%d]\n' % (
@@ -6528,7 +6528,7 @@ def ProcessFile(filename, vlevel, extra_check_functions=[]):
65286528
Error(filename, linenum, 'whitespace/newline', 1,
65296529
'Unexpected \\r (^M) found; better to use only \\n')
65306530

6531-
sys.stdout.write('Done processing %s\n' % path_from_root)
6531+
sys.stdout.write('# Done processing %s\n' % path_from_root)
65326532
_RestoreFilters()
65336533

65346534

0 commit comments

Comments
 (0)