mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
ncinputlayer_init: only read responses on a tty #1469
This commit is contained in:
parent
be1356d213
commit
288381d5b9
@ -902,7 +902,7 @@ control_read(tinfo* tcache, int ttyfd){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
err:
|
err:
|
||||||
fprintf(stderr, "failed on %d (%s)\n", ttyfd, strerror(errno));
|
fprintf(stderr, "Reading control replies failed on %d (%s)\n", ttyfd, strerror(errno));
|
||||||
free(buf);
|
free(buf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -920,9 +920,12 @@ int ncinputlayer_init(tinfo* tcache, FILE* infp){
|
|||||||
nilayer->inputbuf_valid_starts = 0;
|
nilayer->inputbuf_valid_starts = 0;
|
||||||
nilayer->inputbuf_write_at = 0;
|
nilayer->inputbuf_write_at = 0;
|
||||||
nilayer->input_events = 0;
|
nilayer->input_events = 0;
|
||||||
if(control_read(tcache, nilayer->ttyfd >= 0 ? nilayer->ttyfd : nilayer->infd)){
|
int csifd = nilayer->ttyfd >= 0 ? nilayer->ttyfd : nilayer->infd;
|
||||||
|
if(isatty(csifd)){
|
||||||
|
if(control_read(tcache, csifd)){
|
||||||
input_free_esctrie(&nilayer->inputescapes);
|
input_free_esctrie(&nilayer->inputescapes);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user