don't allow f-k-r to run if stdin/stdout not a tty

Another developer noticed that redirecting stdin of `fish_key_reader`
results in weird behavior.  Which is not at all surprising. So add checks
to ensure stdin and stdout are attached to a tty.

Add some rudimentary unit tests for this program.
This commit is contained in:
Kurtis Rader
2016-06-26 21:47:36 -07:00
parent e5011fbcdf
commit d7bc20c933
6 changed files with 77 additions and 0 deletions

8
tests/fkr.expect.out Normal file
View File

@@ -0,0 +1,8 @@
saw expected startup prompt
ctrl-a handled
\xE9, first byte, handled
\xE9, second byte, handled
\c@ handled
invalid terminate sequence handled
valid terminate sequence handled
exited on seeing valid terminate