> Except it does not actually sponge in the stdout case, only when > writing to file. Perhaps it would be better to drop support for stdout? > Or cat temp file to stdout at the end? Why does it open a temp file > when not using it?
Definitely drop stdout support, its existence makes no sense. To keep the code simple, I suggest a read-write temp copy, rather than ever using rename.