Wouldn't messing directly with the parent stty settings mess up stuff
badly if we do end up running tests in parallel at some point?
You are right. The stty trick isn't reliable when tests are run in parallel. And since the whole point is to avoid garbled output when tests are run in parallel, it's not useful.
I was under the wrong impression that each process gets its own set of tty settings to play with but that's not the case. When I was running tests in parallel, it all looked fine but that was just by chance because running W01history.zest is very fast. If I add a `sleep 5` at the start of the first test case and run other tests in parallel, then legitimate output from other tests gets muted.
It looks like we really have to capture output to the tty either with zpty, as Oliver did in his patch for Linux, or with programs like `script`. Unfortunately, `script` doesn't have a standardized interface.
I will try to come up with something that uses `script` if it's present (and from a known platform), otherwise uses `zpty` if the module is available, and otherwise runs the tests without muting the tty.
Philippe