Skip to content

Commit 4c5b665

Browse files
committed
tty: exit 3 on write failure, exit 2 on parse error
1 parent dd40547 commit 4c5b665

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/uu/tty/src/tty.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ mod options {
1919

2020
#[uucore::main(no_signals)]
2121
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
22-
let matches = uucore::clap_localization::handle_clap_result_with_exit_code(uu_app(), args, 2)?;
22+
// tty exits 2 on argument parse errors but 3 on write errors (consistent with its
23+
// normal write-error behavior on line output failures).
24+
let matches =
25+
uucore::clap_localization::handle_clap_result_with_exit_codes(uu_app(), args, 2, 3)?;
2326

2427
// Disable SIGPIPE so we can handle broken pipe errors gracefully
2528
// and exit with code 3 instead of being killed by the signal.

0 commit comments

Comments
 (0)