2 #include "TTYRawMode.h"
4 TTYRawMode::TTYRawMode(int std_in
, int std_out
)
6 // try first stdout, but if it fails - try stdin
7 // this helps to work with specific cases of redirected
8 // output, like working with tee
9 if (tcgetattr(std_out
, &_ts
) != 0) {
10 if (tcgetattr(std_in
, &_ts
) != 0) {
18 struct termios ts_ne
= _ts
;
20 if (tcsetattr( _fd
, TCSADRAIN
, &ts_ne
) != 0) {
25 TTYRawMode::~TTYRawMode()
28 if (tcsetattr(_fd
, TCSADRAIN
, &_ts
) != 0) {
29 perror("~TTYRawMode - tcsetattr");