plesty.bench.streams

How plesty-bench and plesty-server write to their standard streams.

Here, in the client package, because both programs need it and plesty-server depends on plesty-bench, never the other way round.

Functions

printable_output(→ None)

Never let the console's codepage turn output into a crash, or into other characters.

Module Contents

plesty.bench.streams.printable_output() → None

Never let the console’s codepage turn output into a crash, or into other characters.

A job log holds whatever the tools wrote — uv draws its resolution errors with box characters — and a Windows console is cp1252 by default, which cannot encode them. Echoing such a log raised UnicodeEncodeError and the operator got a traceback instead of the one-line error the log actually contained.

A console keeps its own encoding and loses what it cannot draw: a ? is a fair price for the message surviving. Anything redirected is a file or a pipe — a job log, a script reading the client — so it is written as UTF-8 and keeps every character. Without this, plesty-bench piped on Windows wrote the ANSI codepage: the … of a reply became a single 0x85 byte, and whatever read the pipe showed à.

Return type:

None