mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
clint: use fileinput for stdin
Fixes handing of "-" on Python 3: Traceback (most recent call last): File "…/Vcs/neovim/src/clint.py", line 3625, in <module> main() File "…/Vcs/neovim/src/clint.py", line 3618, in main ProcessFile(filename, _cpplint_state.verbose_level) File "…/Vcs/neovim/src/clint.py", line 3464, in ProcessFile 'replace').read().split('\n') File "/usr/lib/python3.7/codecs.py", line 701, in read return self.reader.read(size) File "/usr/lib/python3.7/codecs.py", line 500, in read data = self.bytebuffer + newdata TypeError: can't concat str to bytes
This commit is contained in:
parent
39ad99b594
commit
2351b931dd
@ -49,6 +49,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
import copy
|
import copy
|
||||||
|
import fileinput
|
||||||
import getopt
|
import getopt
|
||||||
import math # for log
|
import math # for log
|
||||||
import os
|
import os
|
||||||
@ -3456,10 +3457,10 @@ def ProcessFile(filename, vlevel, extra_check_functions=[]):
|
|||||||
# is processed.
|
# is processed.
|
||||||
|
|
||||||
if filename == '-':
|
if filename == '-':
|
||||||
lines = codecs.StreamReaderWriter(sys.stdin,
|
stdin = sys.stdin.read()
|
||||||
codecs.getreader('utf8'),
|
if sys.version_info < (3, 0):
|
||||||
codecs.getwriter('utf8'),
|
stdin = stdin.decode('utf8')
|
||||||
'replace').read().split('\n')
|
lines = stdin.split('\n')
|
||||||
else:
|
else:
|
||||||
lines = codecs.open(
|
lines = codecs.open(
|
||||||
filename, 'r', 'utf8', 'replace').read().split('\n')
|
filename, 'r', 'utf8', 'replace').read().split('\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user