aboutsummaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-11-15 20:43:48 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-11-16 23:52:33 +0100
commit813133186ef4023f16c24cf307917e4ba58a76bd (patch)
tree9640a22b4deb3af14d5c1a68da5e16040a4336cb /array.c
parentbab044b8fda309b36b21e6afaa7a91d67a974d26 (diff)
downloadvis-813133186ef4023f16c24cf307917e4ba58a76bd.tar.gz
vis-813133186ef4023f16c24cf307917e4ba58a76bd.tar.xz
ui: work around libtermkey bug when stdin is /dev/null
Libtermkey tries to write a terminal initialization sequence even when stdin is not a terminal as is the case when running `vis < /dev/null` or within the Travis CI environment. The broken code is in libtermkey's driver-ti.c function `start_driver`: /* There's no point trying to write() to a pipe */ if(fstat(tk->fd, &statbuf) == -1) return 0; if(S_ISFIFO(statbuf.st_mode)) return 1; Instead they should simply be using isatty(3). As a workaround we catch the resulting EBADF failure and try to re-open /dev/tty as stdin. If this fails too (as is the case in the Mac OS X Travis CI runner) create an abstract termkey instance instead. In this state vis will not be able to consume any input and will instead spin with 100% CPU usage in the mainloop. This is solely done to make the Lua tests, which control vis through other means, work within the Travis CI environment.
Diffstat (limited to 'array.c')
0 files changed, 0 insertions, 0 deletions