The error comes from perl.c, line 595:
PerlIO_printf(PerlIO_stderr(), "Unable to flush stdout: %s",
Strerror(errno));
This line is part of perl_destruct
, which is called to shut down the perl interpreter at the end of the program.
As part of the global shutdown procedure, all still open filehandles are flushed (i.e. all buffered output is written out). The comment above says:
/* Need to flush since END blocks can produce output */
/* flush stdout separately, since we can identify it */
The error message is not listed in perldoc perldiag
, which is arguably a documentation bug. It was probably overlooked because it's not a real warn
or die
call, it's effectively just print STDERR $message
. It's not associated with a file name or line number because it only happens after your program stops running (i.e. after a call to exit
or because execution fell off the end of the main script).