Added a test to check we do have a tty (and not a pipe in).
[selector.git] / selector.cc
index 9dafd4d..cfb583e 100644 (file)
@@ -388,6 +388,12 @@ void update_screen(int *current_line, int *temporary_line, int motion,
 //////////////////////////////////////////////////////////////////////
 
 int main(int argc, char **argv) {
+
+  if(!ttyname(STDIN_FILENO)) {
+    cerr << "Error: the standard input is not a tty." << endl;
+    exit(1);
+  }
+
   char buffer[buffer_size];
   int color_fg_modeline, color_bg_modeline;
   int color_fg_highlight, color_bg_highlight;