You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
Fix flaky SIGSEGV/SIGBUS crashes in `pty_terminal` tests on musl (Alpine
Linux), plus infrastructure improvements for musl CI.
## Changes
### 1. Fix concurrent PTY SIGSEGV on musl (`RUST_TEST_THREADS=1`)
On musl libc, `fork()` in multi-threaded processes triggers SIGSEGV in
musl internals. When `cargo test` runs multiple test threads, each
calling `openpty()` + `fork()`, musl's internal state gets corrupted.
The fix sets `RUST_TEST_THREADS=1` in the musl CI job to serialize test
execution.
A `#[cfg(target_env = "musl")]` process-wide `Mutex` (`PTY_LOCK`) in
`Terminal::spawn()` serializes PTY spawn and cleanup operations as a
defense-in-depth measure.
### 2. Dynamic musl libc linking (`-C target-feature=-crt-static`)
vite-task is shipped as a NAPI module in vite+, and musl Node with
native modules links to musl libc dynamically. Set `RUSTFLAGS` with `-C
target-feature=-crt-static` for the musl CI job.
### 3. Use `signalfd` for Linux signal handling in tests
Replace `signal_hook::low_level::register` (unsafe signal handler) with
`nix::sys::signalfd::SignalFd` (safe file descriptor) in the
`send_ctrl_c_interrupts_process` test on Linux. macOS/Windows continue
using the `ctrlc` crate.
## Verification
- Musl tests passed in **8+ consecutive CI runs** (mix of push-triggered
and workflow_dispatch)
- All platforms (Linux glibc, Linux musl, macOS arm64/x86, Windows) pass
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments