vezel-dev / cathode

A terminal-centric replacement for the .NET console APIs.
https://docs.vezel.dev/cathode
BSD Zero Clause License
91 stars 7 forks source link

Set the `TOSTOP` bit when switching to raw mode #48

Closed alexrp closed 2 years ago

alexrp commented 2 years ago

When an application switches to raw mode, it's because it wants exclusive control over the terminal to run some kind of interface. To prevent that interface from being messed up by arbitrary background processes, we should set the TOSTOP bit.

This is not completely bulletproof: A really determined background process could block/ignore SIGTTOU to get around TOSTOP, but that's an edge case that we can't do anything about.