Skip to content

Commit

Permalink
Fix issue 16351
Browse files Browse the repository at this point in the history
When using nonstandard output libraries such as
https://github.com/sickill/stderred argumentless writeln() will fail on
the enforce because it check specifically for a newline to be returned.
Checking instead that the output is not EOF follows the documentation
and allows overridden write() functions from the standard library.
  • Loading branch information
andrewbenton committed Aug 3, 2016
1 parent ffa804e commit 65fe993
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion std/stdio.d
Original file line number Diff line number Diff line change
Expand Up @@ -3318,7 +3318,7 @@ void writeln(T...)(T args)
{
import std.exception : enforce;

enforce(fputc('\n', .trustedStdout._p.handle) == '\n', "fputc failed");
enforce(fputc('\n', .trustedStdout._p.handle) != EOF, "fputc failed");
}
else static if (T.length == 1 &&
is(typeof(args[0]) : const(char)[]) &&
Expand Down

0 comments on commit 65fe993

Please sign in to comment.