mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
xargs returns nonzero for negate + not found exe (fixes pcre + not found #447)
This commit is contained in:
parent
0e2c3c1ff9
commit
a157e1a63f
7 changed files with 49 additions and 11 deletions
|
|
@ -172,16 +172,16 @@ def cmd_output(*cmd, **kwargs):
|
|||
try:
|
||||
cmd = parse_shebang.normalize_cmd(cmd)
|
||||
except parse_shebang.ExecutableNotFoundError as e:
|
||||
returncode, stdout, stderr = (-1, e.args[0].encode('UTF-8'), b'')
|
||||
returncode, stdout, stderr = e.to_output()
|
||||
else:
|
||||
popen_kwargs.update(kwargs)
|
||||
proc = __popen(cmd, **popen_kwargs)
|
||||
stdout, stderr = proc.communicate()
|
||||
if encoding is not None and stdout is not None:
|
||||
stdout = stdout.decode(encoding)
|
||||
if encoding is not None and stderr is not None:
|
||||
stderr = stderr.decode(encoding)
|
||||
returncode = proc.returncode
|
||||
if encoding is not None and stdout is not None:
|
||||
stdout = stdout.decode(encoding)
|
||||
if encoding is not None and stderr is not None:
|
||||
stderr = stderr.decode(encoding)
|
||||
|
||||
if retcode is not None and retcode != returncode:
|
||||
raise CalledProcessError(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue