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

@ -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(