From 22882d409400e02b309f2d0802b904bf9e78ef2d Mon Sep 17 00:00:00 2001 From: sharkfisher Date: Fri, 6 Oct 2017 16:20:34 -0400 Subject: [PATCH] tools: fix cpplint.py when path contains non-ascii PR-URL: https://github.com/nodejs/node/pull/16047 Reviewed-By: Refael Ackermann Reviewed-By: Ben Noordhuis --- tools/cpplint.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/cpplint.py b/tools/cpplint.py index 241195f0762709..ca42ddeb7bc477 100644 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -1074,8 +1074,8 @@ def RepositoryName(self): """ fullname = self.FullName() # XXX(bnoordhuis) Expects that cpplint.py lives in the tools/ directory. - toplevel = os.path.abspath( - os.path.join(os.path.dirname(__file__), '..')).replace('\\', '/') + toplevel = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) \ + .replace('\\', '/').decode('utf-8') prefix = os.path.commonprefix([fullname, toplevel]) return fullname[len(prefix) + 1:] @@ -6084,7 +6084,7 @@ def main(): _cpplint_state.ResetErrorCounts() for filename in filenames: - ProcessFile(filename, _cpplint_state.verbose_level) + ProcessFile(filename.decode('utf-8'), _cpplint_state.verbose_level) _cpplint_state.PrintErrorCounts() sys.exit(_cpplint_state.error_count > 0)