f8606810

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

Mutation: emit UTF-8 bytes for output instead of forcing the handle encoding

The mutation child and the driver render results with non-ASCII status markers
(the check/cross marks and box-drawing characters).  Writing them through a
Text.IO / String path encodes via the handle's locale encoding, so under a
C/POSIX locale (a Nix build sandbox) the handle is ASCII and the write crashes
with "cannot encode character" and a non-zero exit.  The earlier workaround was
to hSetEncoding the handles to UTF-8, but that is a global mutable side-effect.

Instead, emit UTF-8 bytes directly, so the handle's encoding is irrelevant:
use safe-coloured-text's putChunksUtf8With / hPutChunksUtf8With (which write a
ByteString builder, no char encoding) everywhere chunks are printed, and encode
printOutputSpecForest's lazy Text to UTF-8 and write the bytes.  Drop the
hSetEncoding calls (in sydTest and the driver) and remove every Data.Text.IO
usage (the runners, OptParse, and a UTF-8 file write in the sqitch-postgres
test).  In a UTF-8 environment the bytes are identical, so there is no change to
golden output.

Suite timing

Time to Start Worker time Duration Time to finish Idle
Config 1m51s 2s 2s 1m53s 1m51s
Eval 2m00s 42s 42s 2m43s 7s
Build - - - - 31m26s
Suite 1m51s 45s - - 33m24s