xargs returns nonzero for negate + not found exe (fixes pcre + not found #447)

This commit is contained in:
Anthony Sottile 2016-12-04 13:31:05 -08:00
parent 0e2c3c1ff9
commit a157e1a63f
7 changed files with 49 additions and 11 deletions

View file

@ -1,6 +1,7 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from pre_commit import parse_shebang
from pre_commit.util import cmd_output
@ -52,6 +53,11 @@ def xargs(cmd, varargs, **kwargs):
stdout = b''
stderr = b''
try:
parse_shebang.normexe(cmd[0])
except parse_shebang.ExecutableNotFoundError as e:
return e.to_output()
for run_cmd in partition(cmd, varargs, **kwargs):
proc_retcode, proc_out, proc_err = cmd_output(
*run_cmd, encoding=None, retcode=None