-
Notifications
You must be signed in to change notification settings - Fork 3
Labels
enhancementNew feature or requestNew feature or request
Description
cpp-linter-hooks/cpp_linter_hooks/util.py
Lines 62 to 72 in 069417d
| def _install_tool(tool: str, version: str) -> Optional[Path]: | |
| """Install a tool using pip, suppressing output.""" | |
| try: | |
| subprocess.check_call( | |
| [sys.executable, "-m", "pip", "install", f"{tool}=={version}"], | |
| stdout=subprocess.DEVNULL, | |
| stderr=subprocess.DEVNULL, | |
| ) | |
| return shutil.which(tool) | |
| except subprocess.CalledProcessError: | |
| return None |
It seems this function fails with _install_tool("clang-format", "9"). It would be nice to know why, but this function does not forward any output from pip when invoking pip exits with non-zero code.
Proposal
For a full descriptiopn of what happened:
try:
subprocess.run(
[sys.executable, "-m", "pip", "install", f"{tool}=={version}"],
capture=True,
check=True,
)
return shutil.which(tool)
except subprocess.CalledProcessError as exc:
LOG.error("pip failed to install %s %s", tool, version)
LOG.error(exc.stdout.decode(encoding="utf-8"))
LOG.error(exc.stderr.decode(encoding="utf-8"))
return NoneMetadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request