Kouhei Sutou
null+****@clear*****
Thu Nov 8 13:24:48 JST 2012
Kouhei Sutou 2012-11-08 13:24:48 +0900 (Thu, 08 Nov 2012) New Revision: 3ebbb7fbcb7b8d5ae407648fd2a11b572240a504 https://github.com/groonga/grntest/commit/3ebbb7fbcb7b8d5ae407648fd2a11b572240a504 Log: Don't run stty if the standard input isn't tty Modified files: lib/grntest/tester.rb Modified: lib/grntest/tester.rb (+11 -3) =================================================================== --- lib/grntest/tester.rb 2012-11-07 15:51:58 +0900 (278d737) +++ lib/grntest/tester.rb 2012-11-08 13:24:48 +0900 (5f01781) @@ -1766,7 +1766,9 @@ EOF end def guess_term_width_from_stty - case `stty -a` + return nil unless STDIN.tty? + + case tty_info when /(\d+) columns/ $1 when /columns (\d+)/ @@ -1774,8 +1776,14 @@ EOF else nil end - rescue SystemCallError - nil + end + + def tty_info + begin + `stty -a` + rescue SystemCallError + nil + end end def string_width(string) -------------- next part -------------- HTML����������������������������... Download