Skip to content

Commit 7cee02f

Browse files
shenxianpeng2bndy5
andcommitted
fix: print stdout and stderr when there is error
Co-authored-by: Brendan <2bndy5@gmail.com>
1 parent 069417d commit 7cee02f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cpp_linter_hooks/util.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ def _install_tool(tool: str, version: str) -> Optional[Path]:
6464
try:
6565
subprocess.check_call(
6666
[sys.executable, "-m", "pip", "install", f"{tool}=={version}"],
67-
stdout=subprocess.DEVNULL,
68-
stderr=subprocess.DEVNULL,
67+
capture_output=True,
68+
check=True,
6969
)
7070
return shutil.which(tool)
71-
except subprocess.CalledProcessError:
71+
except subprocess.CalledProcessError as e:
72+
LOG.error("pip failed to install %s %s", tool, version)
73+
LOG.error(e.stdout.decode(encoding="utf-8"))
74+
LOG.error(e.stderr.decode(encoding="utf-8"))
7275
return None
7376

7477

0 commit comments

Comments
 (0)