feat(cmd): send verbose make logs to stderr#115
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the make command to redirect verbose build logs to stderr while reserving stdout for the final metadata line, allowing callers to capture the output separately. The test suite has been updated to capture both streams concurrently, and a new test has been added to verify this behavior. The review feedback highlights critical issues in the tests: first, modifying global variables makeVerbose and makeOutput without restoring them can cause test pollution; second, ignoring errors from os.Pipe() and failing to close the read ends of the pipes in runMakeCmdStreams and captureBuildModuleStreams leads to potential nil pointer dereferences and file descriptor leaks.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #115 +/- ##
==========================================
+ Coverage 80.43% 80.46% +0.02%
==========================================
Files 37 37
Lines 2116 2129 +13
==========================================
+ Hits 1702 1713 +11
- Misses 300 301 +1
- Partials 114 115 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
45a7ce7 to
56d8f94
Compare
|
/gemini review |
|
/review |
There was a problem hiding this comment.
Code Review
This pull request refactors build output redirection in cmd/llar/internal/make.go by extracting the logic into a redirectBuildOutput helper, which redirects stdout to stderr in verbose mode and discards it in silent mode. It also updates the testing framework to capture both stdout and stderr concurrently using pipes and adds a new integration test for verbose output. The review feedback highlights several issues: 1) os.Stdout and os.Stderr should be restored before closing devNull to prevent panics from concurrent writes; 2) the read ends of the pipes in runMakeCmdStreams and captureProcessStreams should be closed to prevent file descriptor leaks; and 3) the global makeVerbose variable modified in tests should be restored using t.Cleanup to avoid test flakiness.
There was a problem hiding this comment.
Review Summary
Clean refactoring that extracts output redirection into a well-structured helper with proper restore semantics. The new verbose-to-stderr behavior is a solid improvement for machine-parseable stdout. A few items below, mostly in the test code.
Summary
Tests
Note: non-short go test ./cmd/llar/internal still hits existing real integration tests that write to the user cache and failed locally with permission denied.