From: Chip Salzenberg Date: Fri, 21 Mar 1997 19:42:31 +0000 (+1200) Subject: Automatically flush on C< $| = 1 > X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4b65379bc43430e952dd16dee404322de24998dc;p=p5sagit%2Fp5-mst-13.2.git Automatically flush on C< $| = 1 > --- diff --git a/mg.c b/mg.c index c3e6153..5b25c40 100644 --- a/mg.c +++ b/mg.c @@ -1374,9 +1374,18 @@ MAGIC* mg; IoPAGE(GvIOp(defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)); break; case '|': - IoFLAGS(GvIOp(defoutgv)) &= ~IOf_FLUSH; - if ((SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)) != 0) { - IoFLAGS(GvIOp(defoutgv)) |= IOf_FLUSH; + { + IO *io = GvIOp(defoutgv); + if ((SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)) == 0) + IoFLAGS(io) &= ~IOf_FLUSH; + else { + if (!(IoFLAGS(io) & IOf_FLUSH)) { + PerlIO *ofp = IoOFP(io); + if (ofp) + (void)PerlIO_flush(ofp); + IoFLAGS(io) |= IOf_FLUSH; + } + } } break; case '*':