mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-18 01:40:06 +02:00
fold: exit promptly upon write errors
* NEWS: Mention the improvement. * src/fold.c (fold_file): Check for write errors after each buffer read from stdin. * tests/misc/write-errors.sh: Add test cases.
This commit is contained in:
3
NEWS
3
NEWS
@@ -142,6 +142,9 @@ GNU coreutils NEWS -*- outline -*-
|
||||
'factor' is now much faster at identifying large prime numbers,
|
||||
and significantly faster on composite numbers greater than 2^128.
|
||||
|
||||
fold now exits promptly upon receiving a write error,
|
||||
which is significant when reading large / unbounded inputs.
|
||||
|
||||
'seq' is more accurate with large integer start values.
|
||||
Previously 'seq 18446744073709551617 inf | head -n1' would
|
||||
output the number before the user specified start value.
|
||||
|
||||
@@ -272,6 +272,10 @@ fold_file (char const *filename, size_t width)
|
||||
}
|
||||
if (feof (istream))
|
||||
break;
|
||||
|
||||
if (ferror (stdout))
|
||||
write_error ();
|
||||
|
||||
/* We read a full buffer of complete characters. */
|
||||
offset_in = 0;
|
||||
|
||||
|
||||
@@ -34,7 +34,9 @@ dd if=/dev/zero
|
||||
expand /dev/zero
|
||||
factor --version; yes 1 | factor
|
||||
# TODO: fmt /dev/zero
|
||||
# TODO: fold -b /dev/zero
|
||||
fold /dev/zero
|
||||
fold -b /dev/zero
|
||||
fold -c /dev/zero
|
||||
head -z -n-1 /dev/zero
|
||||
join -a 1 -z /dev/zero /dev/null
|
||||
# TODO: nl --version; yes | nl
|
||||
|
||||
Reference in New Issue
Block a user