From what I can tell, there are exactly two use cases for termios in the embedded script interpreter:
Getting the size of the terminal (done from embedded_interpreter initialization, and dotest.py) and
Turning on or off echo (also done from embedded_interpreter initialization, and dotest.py)
I’m curious about the history here. What is the reason for this code? In my testing so far I haven’t been able to exercise these codepaths on Windows, so I’m not sure if they’re MacOSX only or something like that. If it’s possible to exercise these code paths on Windows I’ll need to move this functionality behind another module that reproduces these two use cases on Windows.
This stuff is for running the embedded interpreter within an IDE where the IDE create a new SBDebugger and then gives us the in/out/err file handles from the slave side of a pseudo terminal. Xcode, our IDE, currently uses this method and we ended up with a double echo of any characters since they use a normal Cocoa text field and they don't have the notion of not echoing characters like a real terminal does. So this is a kind of hack that says "the file handles we have been given for in/out/err claim to be terminals (pty) but they don't actually have a height and width, so we know this means the special pseudo terminal IDE case and we can avoid the double echo issue.
For normal command line stuff this can be disabled and for anything non darwin it can be disabled.