Skip to content

Commit ea61894

Browse files
Sweep json_envelope, update_notifier, main, path_scope (#1967)
* Start sweep of json_envelope, update_notifier Assisted-by: Claude Code:claude-opus-5-5 * Sweep json_envelope, update_notifier, main update_notifier: inline in_ci, upgrade_command and grace_budget; one millis_or parser for the timeout and grace knobs; guard types private; the notice test compares exact plain and colored strings. main/interrupt: the SIGPIPE reset moves into interrupt::install. json_envelope: drop the unused sidecar re-export and the test-only GcReport::to_value; usage_error prints through ui::print_json; trim stale and history docs. Tests that claimed "every" action, command or status now cover all variants; drop 4 duplicate tests and the JSON string round trips. path_scope: replace a tautological bind-vs-matches test and a duplicate; add the relative --cwd strip case. Assisted-by: Claude Code:claude-opus-5-5 * Clarify SIGPIPE reset and envelope scope docs Assisted-by: Claude Code:claude-opus-5-5 * Restore the bare * path-scope assertion The sweep dropped it together with a stale comment. No other test covers a bare * pattern. Assisted-by: Claude Code:claude-opus-5-5 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ec9ff24 commit ea61894

5 files changed

Lines changed: 197 additions & 447 deletions

File tree

‎crates/socket-patch-cli/src/interrupt.rs‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@
1212
//!
1313
//! Only an uncatchable kill (SIGKILL, power loss) can still leave the file,
1414
//! and the next lock-taking command reclaims and removes it.
15+
//!
16+
//! On Unix, [`install`] also resets SIGPIPE to its default disposition
17+
//! (unconditionally, unlike the signals above), so a pipe consumer that
18+
//! closes stdout ends the process quietly instead of a panic on EPIPE.
19+
//! Network writes still suppress SIGPIPE through std/socket2.
1520
1621
use socket_patch_core::patch::apply_lock::cleanup_held_lock_on_interrupt;
1722

18-
/// Install the interrupt handlers. Call once, first thing in `main`.
23+
/// Install the interrupt handlers (and, on Unix, the default SIGPIPE
24+
/// disposition). Call once, first thing in `main`, before any output.
1925
///
2026
/// Unix: a signal the process started with ignored (`nohup`, a launcher
2127
/// that ignores Ctrl-C) keeps being ignored. The prompt's cursor guard
@@ -45,6 +51,10 @@ mod imp {
4551
}
4652

4753
pub(super) fn install() {
54+
// SAFETY: SIG_DFL is a valid disposition for SIGPIPE.
55+
unsafe {
56+
libc::signal(libc::SIGPIPE, libc::SIG_DFL);
57+
}
4858
for sig in SIGNALS {
4959
// SAFETY: plain sigaction calls with zeroed, then filled,
5060
// structs; the handler only calls async-signal-safe code.

0 commit comments

Comments
 (0)