Skip to content

Commit fdbfcae

Browse files
committed
fix: capture stderr in subprocess output for clang-tidy
1 parent 91a795b commit fdbfcae

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

cpp_linter_hooks/clang_tidy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ def run_clang_tidy(args=None) -> Tuple[int, str]:
1818
retval = 0
1919
output = ""
2020
try:
21-
sp = subprocess.run(command, stdout=subprocess.PIPE, encoding="utf-8")
21+
sp = subprocess.run(
22+
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8"
23+
)
2224
retval = sp.returncode
23-
output = sp.stdout
25+
output = (sp.stdout or "") + (sp.stderr or "")
2426
if "warning:" in output or "error:" in output:
2527
retval = 1
2628
return retval, output

0 commit comments

Comments
 (0)