don't try to preserve termios sans terminal

This commit is contained in:
nick black 2021-05-27 17:03:24 -04:00 committed by Nick Black
parent a4337ef144
commit a0130a88e6

View File

@ -186,10 +186,12 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
unsigned noaltscreen, unsigned nocbreak){ unsigned noaltscreen, unsigned nocbreak){
memset(ti, 0, sizeof(*ti)); memset(ti, 0, sizeof(*ti));
ti->utf8 = utf8; ti->utf8 = utf8;
if(fd >= 0){
if(tcgetattr(fd, &ti->tpreserved)){ if(tcgetattr(fd, &ti->tpreserved)){
fprintf(stderr, "Couldn't preserve terminal state for %d (%s)\n", fd, strerror(errno)); fprintf(stderr, "Couldn't preserve terminal state for %d (%s)\n", fd, strerror(errno));
return -1; return -1;
} }
}
if(ncinputlayer_init(&ti->input, stdin)){ if(ncinputlayer_init(&ti->input, stdin)){
return -1; return -1;
} }