Skip to content

Refactor to remove dead stderr capture pipe and improve subprocess handling - #184

Merged
ocean merged 2 commits into
ahoy-cli:masterfrom
ocean:cleanup/stderr-pipe-removal
Sep 1, 2026
Merged

ocean merged 2 commits into
ahoy-cli:masterfrom
ocean:cleanup/stderr-pipe-removal

Conversation

@ocean

@ocean ocean commented Sep 1, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Subprocesses now inherit ahoy’s original standard error stream directly.
    • Error output is no longer routed through an internal pipe, improving descriptor compatibility and passthrough behaviour.
  • Tests

    • Added regression coverage confirming subprocesses receive the expected standard error descriptor.

Follow-up to ahoy-cli#181, which fixed the symptom of ahoy-cli#180 by handing subprocesses
the stderr captured at startup. The pipe it worked around is itself dead
code: it was added in 3aa069a to intercept cobra's error output, and that
job has since moved to SilenceErrors plus the error translation in main().
What remained copied stderr to stderr, achieving nothing but the loss of
fd 2's terminal properties - and needed a drain goroutine to avoid the
deadlock it introduced.

Removing it lets subprocesses use os.Stderr directly again and drops the
commandStderr indirection from appState.

The Go test is reframed to assert the behaviour rather than the mechanism,
and a BATS test now pins the descriptor kind end to end - verified to fail
against master and pass with the fix.

Claude-Session: https://claude.ai/code/session_01629NFuQxTr678Tdh8AD39d
@coderabbitai

coderabbitai Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 54471254-385e-47fe-9d9e-3d8e7c02356f

📥 Commits

Reviewing files that changed from the base of the PR and between efa3595 and 516f359.

📒 Files selected for processing (3)
  • ahoy.go
  • ahoy_test.go
  • tests/stderr-passthrough.bats

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

Ahoy no longer routes stderr through an internal pipe. Ahoy and its subprocesses use the original os.Stderr. Unit and Bats tests verify that subprocess file descriptor 2 is not a pipe.

Changes

Stderr inheritance

Layer / File(s) Summary
Direct stderr wiring
ahoy.go
The application removes commandStderr and stderr pipe routing. Subprocesses now use os.Stderr directly.
Stderr inheritance validation
ahoy_test.go, tests/stderr-passthrough.bats
Tests verify that subprocess file descriptor 2 is a regular file rather than an internal pipe.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 516f3

This change removes a dead stderr capture pipe and refines subprocess handling; no actionable merge-blocking risk remains based on the supplied evidence.

Suggested reviewers: hanoii

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarises the main change: removal of the stderr capture pipe and improved subprocess stderr handling.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ocean
ocean merged commit 0ceb767 into ahoy-cli:master Sep 1, 2026
13 checks passed
@ocean
ocean deleted the cleanup/stderr-pipe-removal branch September 1, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址