mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-25 16:48:57 -05:00
xargs returns nonzero for negate + not found exe (fixes pcre + not found #447)
This commit is contained in:
+5
-5
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user