From eb483b660f01ec4e8d39c3d4bff21ce8019f0f32 Mon Sep 17 00:00:00 2001 From: Socialpranker <273312799+Socialpranker@users.noreply.github.com> Date: Mon, 7 Sep 2026 15:00:42 +0200 Subject: [PATCH] tests: don't pipe input into commands that exit before reading it sort -t== and numfmt --from-unit -1 fail while parsing arguments, so they never read stdin. The pipe_in thread races that exit and intermittently fails the test with "failed to write to stdin of child: Broken pipe". These four tests do not need input at all, so pipe nothing. --- tests/by-util/test_numfmt.rs | 4 ++-- tests/by-util/test_sort.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index 788ead0c0f0..12854a77d81 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -184,7 +184,7 @@ fn test_unit_size_hyphen_leading_as_separate_arg() { for opt in ["--from-unit", "--to-unit"] { new_ucmd!() .args(&[opt, "-1"]) - .pipe_in("5\n") + .pipe_in("") .fails() .stderr_contains("invalid unit size: '-1'"); } @@ -196,7 +196,7 @@ fn test_unit_hyphen_leading_as_separate_arg() { for opt in ["--from", "--to"] { new_ucmd!() .args(&[opt, "-x"]) - .pipe_in("5\n") + .pipe_in("") .fails() .stderr_contains("invalid argument '-x' for '--"); } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 67934256ec3..e3282ac6f8d 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -1894,7 +1894,7 @@ fn test_separator_attached_equals_double() { // `-t==` selects the two-character separator `==`, which GNU rejects. new_ucmd!() .args(&["-t==", "-k", "2"]) - .pipe_in("a=b=c\n") + .pipe_in("") .fails() .stderr_contains("separator must be exactly one character long: '=='"); } @@ -1904,7 +1904,7 @@ fn test_separator_attached_equals_multi_char() { // `-t=a` selects the two-character separator `=a`, which GNU rejects. new_ucmd!() .args(&["-t=a", "-k", "2"]) - .pipe_in("a=b=c\n") + .pipe_in("") .fails() .stderr_contains("separator must be exactly one character long: '=a'"); }