mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-05-06 23:39:13 -05:00
Allow arbitrary bytes in output. Resolves #245
This commit is contained in:
@@ -102,8 +102,9 @@ def _run_single_hook(hook, repo, args, write, skips=frozenset()):
|
||||
write('hookid: {0}\n'.format(hook['id']))
|
||||
write('\n')
|
||||
for output in (stdout, stderr):
|
||||
assert type(output) is bytes, type(output)
|
||||
if output.strip():
|
||||
write(output.strip() + '\n')
|
||||
write(output.strip() + b'\n')
|
||||
write('\n')
|
||||
|
||||
return retcode
|
||||
|
||||
@@ -22,6 +22,7 @@ def run_hook(env, hook, file_args):
|
||||
' '.join(['xargs', '-0', '-s4000', hook['entry']] + quoted_args),
|
||||
stdin=file_args_to_stdin(file_args),
|
||||
retcode=None,
|
||||
encoding=None,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -24,4 +24,5 @@ def run_hook(repo_cmd_runner, hook, file_args):
|
||||
],
|
||||
stdin=file_args_to_stdin(file_args),
|
||||
retcode=None,
|
||||
encoding=None,
|
||||
)
|
||||
|
||||
@@ -17,4 +17,5 @@ def run_hook(repo_cmd_runner, hook, file_args):
|
||||
# TODO: this is duplicated in pre_commit/languages/helpers.py
|
||||
stdin=file_args_to_stdin(file_args),
|
||||
retcode=None,
|
||||
encoding=None,
|
||||
)
|
||||
|
||||
@@ -18,4 +18,5 @@ def run_hook(repo_cmd_runner, hook, file_args):
|
||||
['xargs', '-0'] + shlex.split(hook['entry']) + hook['args'],
|
||||
stdin=file_args_to_stdin(file_args),
|
||||
retcode=None,
|
||||
encoding=None,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user