[swift-dev] print buffering

Drew Crawford drew at sealedabstract.com
Fri Apr 1 16:52:55 CDT 2016

We noticed today when running a swift CLI program to a pipe that stdout is fully buffered (e.g. not unbuffered, not line-buffered).  So just now we committed unbuffering IO to a bunch of CLI programs.

Is this the right default behavior for Swift?

I realize this is a Cism with a long history, but I think an argument can be made that the Cism is surprising (in that: it surprised us). I think most Swift developers would assume "print" to be line-buffered.

Requiring programs to opt-in to linebuffering so they can work via pipe feels wrong to me.  Am I crazy?


More information about the swift-dev mailing list