mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
cope with situations where /dev/tty is not actually a TTY
this can happen in situations where a child process is not running in a session group associated with a TTY, such as on a build server.
This commit is contained in:
parent
66bd8c9769
commit
b49ac58d3e
@ -934,6 +934,12 @@ get_tty_fd(notcurses* nc, FILE* ttyfp){
|
||||
fd = open("/dev/tty", O_RDWR | O_CLOEXEC);
|
||||
if(fd < 0){
|
||||
loginfo(nc, "Error opening /dev/tty (%s)\n", strerror(errno));
|
||||
}else{
|
||||
if(!isatty(fd)){
|
||||
loginfo(nc, "File descriptor for /dev/tty (%d) is not actually a TTY\n", fd);
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return fd;
|
||||
|
Loading…
Reference in New Issue
Block a user