|No such thing as a small change|
Re^9: Threads Printing Issue - Output Mangled / Term Crashingby salva (Abbot)
|on Apr 15, 2014 at 06:56 UTC||Need Help??|
strace may show something interesting. For instance:
On my computer that works pretty fine, and I don't see any tty access. Maybe just updating the ssh client could solve your problem.
update: Ah, I can see what's happening:
ssh -tt ... reads the terminal flags from STDIN (ioctl(0, TCGETS, ...)), sets new ones (ioctl(0, TCSETSW,, ...)) and runs the remote command. Then, upon exit, it restores the original flags.
The issue is that with multiple ssh processes running in parallel, some of them may read the already modified flags and so later, reset STDIN to an incorrect state.
An easy workaround is to wrap the part of the code where the threads are started and then joined with an extra couple of TCGETS/TCSETSW ioctl calls. Another option is to just redirect STDIN from /dev/null.
update 2: The following program works correctly on my computer: