fix(process): share ETXTBSY retry helper across git/bd/os spawns#46
Merged
Conversation
The Linux "Text file busy" race that the git module already handled (commit 2368c7a) also hits the brew-install probe in os.rs — the 0.8.1 CI surfaced it as `macos_with_brew_propagates_failure` panicking because the spawned brew stub raced its own write fd. Promote the retry helper to a shared `hew_core::process` module and route every in-tree spawn site through it: - hew_core::process::spawn_with_etxtbsy_retry — new shared module. pub(crate) so the binary doesn't see it but every hew-core module can. Exponential backoff up to ~150ms total, then a final attempt. - hew_core::git: drop the local copy, import from process. - hew_core::os::run_brew_install_git: use the helper (fixes the failing test). - hew_core::bd::RealBd::run / run_to_file_inner: use the helper for defense in depth — bd's tests don't stub-install today, but the same race applies any time the binary itself gets rewritten under a concurrent reader (hew init refresh during a parallel run). Verification: - Failing test `macos_with_brew_propagates_failure`: now passes 10/10 in a stress loop. - cargo test (default + --no-default-features): green. - cargo clippy --all-targets -- -D warnings: clean. - cargo fmt --all -- --check: clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Symbols touched (per
hew blast)hew_core::process::spawn_with_etxtbsy_retry(new)hew_core::os::run_brew_install_git(use helper)hew_core::bd::RealBd::run+run_to_file_inner(use helper)hew_core::lib(module declaration)Test plan
🤖 Generated with Claude Code