mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-15 13:30:17 -06:00
Fix Py3
This commit is contained in:
@@ -2,6 +2,8 @@ import os
|
||||
import os.path
|
||||
import subprocess
|
||||
|
||||
from pre_commit import five
|
||||
|
||||
|
||||
class CalledProcessError(RuntimeError):
|
||||
def __init__(self, returncode, cmd, expected_returncode, output=None):
|
||||
@@ -63,6 +65,11 @@ class PrefixedCommandRunner(object):
|
||||
replaced_cmd = _replace_cmd(cmd, prefix=self.prefix_dir)
|
||||
proc = self.__popen(replaced_cmd, **popen_kwargs)
|
||||
stdout, stderr = proc.communicate(stdin)
|
||||
# TODO: stdout, stderr = from_bytes(stdout), from_bytes(stderr)
|
||||
if stdout is not None and not isinstance(stdout, five.text):
|
||||
stdout = five.text(stdout, 'utf-8')
|
||||
if stderr is not None and not isinstance(stderr, five.text):
|
||||
stderr = five.text(stderr, 'utf-8')
|
||||
returncode = proc.returncode
|
||||
|
||||
if retcode is not None and retcode != returncode:
|
||||
|
||||
Reference in New Issue
Block a user