diff options
author | Tony Cook <tony@develop-help.com> | 2015-11-04 16:52:37 +1100 |
---|---|---|
committer | Ricardo Signes <rjbs@cpan.org> | 2016-03-17 19:52:56 -0400 |
commit | 8abddda39a55d116a506c465ef0ccd0f8546b896 (patch) | |
tree | 5509cbb4988496c479a8b0b5acf693936eec7ad8 /perl.c | |
parent | 756bd853cd4bf0ba281f8bf508596fbb779c4a5c (diff) | |
download | perl-8abddda39a55d116a506c465ef0ccd0f8546b896.tar.gz |
report an error and fail if we can't flush stdout
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -585,6 +585,19 @@ perl_destruct(pTHXx) assert(PL_scopestack_ix == 0); /* Need to flush since END blocks can produce output */ + /* flush stdout separately, since we can identify it */ +#ifdef USE_PERLIO + { + PerlIO *stdo = PerlIO_stdout(); + if (*stdo && PerlIO_flush(stdo)) { + PerlIO_restore_errno(stdo); + PerlIO_printf(PerlIO_stderr(), "Unable to flush stdout: %s", + Strerror(errno)); + if (!STATUS_UNIX) + STATUS_ALL_FAILURE; + } + } +#endif my_fflush_all(); #ifdef PERL_TRACE_OPS |