fix: Use 'close' event instead of 'exit' for reliable stdout capture on macOS#58
fix: Use 'close' event instead of 'exit' for reliable stdout capture on macOS#58
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #57
…on macOS
The 'exit' event fires when the process terminates, but stdio streams may
still have buffered data. On macOS, fast-executing commands like 'echo hi'
could exit before stdout data events fired, causing:
- No command output displayed
- No finish block shown
- Process appearing to hang
Fix:
- JS: Changed child.on('exit') to child.on('close') which fires after all
stdio streams have been closed, ensuring all data is received
- Rust: Changed from Stdio::inherit() with .output() to Stdio::piped() with
.spawn(), using threads to read stdout/stderr in real-time while also
capturing for the log file
Root cause analysis and documentation added to docs/case-studies/issue-57/
Fixes #57
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
$ echo 'hi' does not finishes on macOS and shows not output without isolation🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Check for changesets for rust passed - https://github.com/link-foundation/start/actions/runs/20790282454/job/59710582348?pr=58, but it should not pass - code changed, and no changesets where added. CI/CD check must be fixed, so this and all future pull requests will be checked. |
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Thank you for catching that! I've added a changelog fragment for the Rust implementation in |
This reverts commit 3875cfd.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
Check for changesets for rust passed - https://github.com/link-foundation/start/actions/runs/20790282454/job/59710582348?pr=58, but it should not pass - code changed, and no changesets where added. CI/CD check must be fixed, so this and all future pull requests will be checked. Before 30f15eb, at d38a67f. That is critical bug, I see no changes in CI/CD for rust.yml, please fix it. Please download all logs and data related about the issue to this repository, make sure we compile that data to |
|
🤖 AI Work Session Started Starting automated work session at 2026-01-07T17:38:17.593Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback. |
The Rust changelog check was using `exit 0` (success) even when no changelog fragment was found, effectively making it a no-op. This allowed PRs to pass without proper changelog documentation. Changes: - Changed `exit 0` to `exit 1` to fail the check when fragments are missing - Changed `::warning::` to `::error::` for consistent GitHub Actions annotation Also updated the case study documentation to include detailed analysis of this CI/CD bug and the lessons learned. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CI/CD Changelog Check Bug FixI've fixed the critical bug you identified in the Rust changelog fragment check. Here's the summary: The BugIn if [ "$SOURCE_CHANGED" -gt 0 ] && [ "$FRAGMENTS" -eq 0 ]; then
echo "::warning::No changelog fragment found..."
exit 0 # BUG: This should be exit 1!
fiThe FixChanged to properly fail the check: if [ "$SOURCE_CHANGED" -gt 0 ] && [ "$FRAGMENTS" -eq 0 ]; then
echo "::error::No changelog fragment found..."
exit 1 # Now properly fails
fiChanges Made
Verification
DocumentationUpdated
🤖 Generated with Claude Code |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
This commit applies best practices discovered in link-foundation repositories (start, lino-env) to improve the Rust CI/CD pipeline. Changes: - Fix deprecated ::set-output GitHub Actions command in version-and-commit.mjs - Change changelog fragment check from warning to error (exit 1) - Add always() && !cancelled() to job conditions to fix workflow_dispatch skipping - Add release_mode input with "instant" and "changelog-pr" options - Add crates.io publishing support to auto-release and manual-release jobs - Add --tag-prefix and --crates-io-url options to create-github-release.mjs - Add comprehensive case study documentation in docs/case-studies/issue-11/ References: - link-foundation/start#58 - link-foundation/lino-env#27 - link-foundation/lino-env#25 - link-foundation/lino-env#23 Fixes #11 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Fixes #57 -
$ echo 'hi'does not finish on macOS and shows no output without isolation.Root Cause
The JavaScript implementation used the
exitevent to handle process completion:The problem is that the
exitevent fires when the process terminates, but stdio streams may still have buffered data. On macOS, fast-executing commands likeecho hicould exit before stdout data events fired, causing:According to Node.js documentation:
Solution
JavaScript (
js/src/bin/cli.js):child.on('exit', ...)tochild.on('close', ...)closeevent fires after all stdio streams have been closed, ensuring all data is receivedRust (
rust/src/bin/main.rs):Stdio::inherit()with.output()toStdio::piped()with.spawn()CI/CD Fix (Addendum)
Fixed a critical bug in the Rust changelog fragment check (
.github/workflows/rust.yml):exit 0(success) even when no changelog fragment was foundexit 1to properly fail the check when fragments are missing::warning::to::error::for consistent GitHub Actions annotationSee
docs/case-studies/issue-57/README.mdfor the full analysis.Test Plan
$ echo 'hi'now shows output and finish blockCase Study
A detailed root cause analysis has been added to
docs/case-studies/issue-57/README.mddocumenting:exitvscloseevents🤖 Generated with Claude Code