Fixed spurious encoding error

Using errors=replace in python utf-8 decoding makes these scripts more
resilient to underlying errors, rather than just throwing an unhelpfully
generic decode error.
This commit is contained in:
Christopher Haster
2022-03-11 21:54:31 -06:00
parent 9d54603ce2
commit e4adefd1d7
3 changed files with 6 additions and 3 deletions

View File

@@ -31,7 +31,8 @@ def collect(paths, **args):
proc = sp.Popen(cmd,
stdout=sp.PIPE,
stderr=sp.PIPE if not args.get('verbose') else None,
universal_newlines=True)
universal_newlines=True,
errors='replace')
for line in proc.stdout:
m = pattern.match(line)
if m:

View File

@@ -31,7 +31,8 @@ def collect(paths, **args):
proc = sp.Popen(cmd,
stdout=sp.PIPE,
stderr=sp.PIPE if not args.get('verbose') else None,
universal_newlines=True)
universal_newlines=True,
errors='replace')
for line in proc.stdout:
m = pattern.match(line)
if m:

View File

@@ -35,7 +35,8 @@ def collect(paths, **args):
proc = sp.Popen(cmd,
stdout=sp.PIPE,
stderr=sp.PIPE if not args.get('verbose') else None,
universal_newlines=True)
universal_newlines=True,
errors='replace')
for line in proc.stdout:
# state machine here to find structs
m = pattern.match(line)