diff --git a/NEWS b/NEWS index cf1b1414e..7567a488f 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,9 @@ GNU coreutils NEWS -*- outline -*- ** Improvements + 'groups' will now exit immediately upon receiving a write error, which is + significant when listing information for many users. + 'nl' now supports multi-byte --section-delimiter characters. 'shuf -i' now operates up to two times faster on systems with unlocked stdio diff --git a/src/groups.c b/src/groups.c index faed5c810..3daf410d9 100644 --- a/src/groups.c +++ b/src/groups.c @@ -134,6 +134,9 @@ main (int argc, char **argv) if (!print_group_list (argv[optind], ruid, rgid, egid, true, ' ')) ok = false; putchar ('\n'); + + if (fflush (stdout) < 0) + write_error (); } } diff --git a/tests/misc/io-errors.sh b/tests/misc/io-errors.sh index 63649603e..29929f652 100755 --- a/tests/misc/io-errors.sh +++ b/tests/misc/io-errors.sh @@ -44,6 +44,7 @@ fmt foo fold foo fold -b foo fold -c foo +groups head -n1 foo join foo foo nl foo