1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-20 10:51:48 +02:00

nl: promptly diagnose write errors

* NEWS: Mention the improvement.
* src/nl.c (process_file): Exit if error outputting line.
* tests/misc/write-errors.sh: Enable the test case.
This commit is contained in:
Pádraig Brady
2025-10-22 16:31:15 +01:00
parent c12a2ecb53
commit 9415cf01c6
3 changed files with 5 additions and 2 deletions

2
NEWS
View File

@@ -43,7 +43,7 @@ GNU coreutils NEWS -*- outline -*-
** Improvements
'fmt' will now exit promptly upon receiving a write error,
'fmt' and 'nl' will now exit promptly upon receiving a write error,
which is significant when reading large / unbounded inputs.
'install' now uses posix_spawn() to invoke the strip program more efficiently.

View File

@@ -425,6 +425,9 @@ process_file (FILE *fp)
proc_text ();
break;
}
if (ferror (stdout))
write_error ();
}
}

View File

@@ -41,7 +41,7 @@ fold -c /dev/zero
fold --version; yes | tr -d '\\n' | fold
head -z -n-1 /dev/zero
join -a 1 -z /dev/zero /dev/null
# TODO: nl --version; yes | nl
nl --version; yes | nl
numfmt --version; yes 1 | numfmt
od -v /dev/zero
paste /dev/zero