diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2021-11-30 15:15:20 -0500 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2021-11-30 15:15:20 -0500 |
commit | 9eb357e008385176a44b695e6117f95b2ea104a7 (patch) | |
tree | 84c94e9ff50ca39b3e139c1dc3c7d1310903bd5a /io.c | |
parent | 5870bfcddf538fac3b87b65abc716d34766d94cf (diff) | |
download | egawk-9eb357e008385176a44b695e6117f95b2ea104a7.tar.gz egawk-9eb357e008385176a44b695e6117f95b2ea104a7.tar.bz2 egawk-9eb357e008385176a44b695e6117f95b2ea104a7.zip |
Flush output to redirections before closing to detect output errors.
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1375,6 +1375,9 @@ close_redir(struct redirect *rp, bool exitwarn, two_way_close_type how) if (rp == NULL) return 0; + if ((rp->flag & RED_WRITE) && rp->output.fp) + /* flush before closing to leverage special error handling */ + efflush(rp->output.fp, "flush", rp); if (rp->output.fp == stdout || rp->output.fp == stderr) goto checkwarn; /* bypass closing, remove from list */ |