From 951d423cb3aa421a271c287d45702fb0072d4681 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Tue, 17 Mar 2009 20:31:00 +0100 Subject: [PATCH] Added a test to check we do have a tty (and not a pipe in). --- selector.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/selector.cc b/selector.cc index 9dafd4d..cfb583e 100644 --- a/selector.cc +++ b/selector.cc @@ -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; -- 2.39.5