radicle-heartwood-lfs/crates/radicle-term/src
Fintan Halpenny e1f16bee26 term: Catch EPIPE and swallow
Rust (since 1.62) ignores EPIPE by default (see [Rust #62569]),
causing writes to closed pipes to return `io::ErrorKind::BrokenPipe`
errors.  The `println!` macro panics on these errors, producing a
confusing backtrace instead of the silent exit expected of Unix CLI
tools.

To avoid the use of `print!` and `println!`, the `radicle-term`
helper functions use `write!` and `writeln!`. This lays the groundwork
for the `rad` CLI to transition to using only `radicle-term`
functions.

There was a first attempt made, which is documented here.  A
process-wide SIGPIPE reset (`SIG_DFL`) was ruled out because `rad`
manages child processes via libgit2 pipes and communicates with the
radicle node over Unix sockets. Resetting SIGPIPE globally caused
`rad` itself to be killed during internal pipe operations (e.g. during
`rad remote add --fetch`), producing flaky test failures.

[Rust #62569] https://github.com/rust-lang/rust/issues/62569
2026-04-29 10:57:24 +02:00
..
ansi rust/edition/fmt: 2021 → 2024 2026-03-30 16:57:51 +02:00
ansi.rs rust/edition/fmt: 2021 → 2024 2026-03-30 16:57:51 +02:00
args.rs refactor: Replace return Err(anyhow!()) with anyhow::bail!() 2025-08-17 20:17:11 +02:00
cell.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
colors.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
editor.rs use `CONIN$` instead of `/dev/tty` on windows 2026-03-17 10:27:30 +00:00
element.rs term: Catch EPIPE and swallow 2026-04-29 10:57:24 +02:00
format.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
hstack.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
io.rs term: Catch EPIPE and swallow 2026-04-29 10:57:24 +02:00
label.rs rust/edition/fmt: 2021 → 2024 2026-03-30 16:57:51 +02:00
lib.rs rust/edition/fmt: 2021 → 2024 2026-03-30 16:57:51 +02:00
spinner.rs term: Use static template in spinner initialization 2025-09-15 11:17:35 +02:00
table.rs term/table: Add Table::with_opts() to set options after Table obj was constructed 2025-09-10 21:23:30 +02:00
textarea.rs rust/edition/fmt: 2021 → 2024 2026-03-30 16:57:51 +02:00
vstack.rs radicle-term: Pass in `mut self` rather than rebinding 2025-08-27 23:18:33 +02:00