Avoid initializing readline if not writing to terminal.
authorJán Kupec <jkupec@suse.cz>
Mon, 27 Jul 2009 10:02:52 +0000 (12:02 +0200)
committerJán Kupec <jkupec@suse.cz>
Mon, 27 Jul 2009 10:02:52 +0000 (12:02 +0200)
src/utils/misc.cc

index 618dcd0..6fe4ce9 100644 (file)
@@ -61,6 +61,9 @@ string readline_getline()
 
 unsigned get_screen_width()
 {
+  if (!::isatty(STDOUT_FILENO))
+    return 80;
+
   int width = 80;
 
   const char *cols_env = getenv("COLUMNS");