summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fzy.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fzy.c b/src/fzy.c
index 23f5673..6b9aa5a 100644
--- a/src/fzy.c
+++ b/src/fzy.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
+#include <unistd.h>
#include "match.h"
#include "tty.h"
@@ -39,10 +40,15 @@ int main(int argc, char *argv[]) {
}
} else {
/* interactive */
+
+ if (isatty(STDIN_FILENO))
+ choices_fread(&choices, stdin);
+
tty_t tty;
tty_init(&tty, options.tty_filename);
- choices_fread(&choices, stdin);
+ if (!isatty(STDIN_FILENO))
+ choices_fread(&choices, stdin);
if (options.num_lines > choices.size)
options.num_lines = choices.size;