You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:00:24 UTC

svn commit: r1181343 - /hbase/branches/0.89/src/main/ruby/shell/formatter.rb

Author: nspiegelberg
Date: Tue Oct 11 02:00:24 2011
New Revision: 1181343

URL: http://svn.apache.org/viewvc?rev=1181343&view=rev
Log:
HBASE-2815 not able to run the test suite in background because TestShell

Summary:

Importing fix from trunk. See discussion up in:
https://issues.apache.org/jira/browse/HBASE-2815

Reviewed By: kranganathan

Test Plan: mvntest TestShell &

Modified:
    hbase/branches/0.89/src/main/ruby/shell/formatter.rb

Modified: hbase/branches/0.89/src/main/ruby/shell/formatter.rb
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/ruby/shell/formatter.rb?rev=1181343&r1=1181342&r2=1181343&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/ruby/shell/formatter.rb (original)
+++ hbase/branches/0.89/src/main/ruby/shell/formatter.rb Tue Oct 11 02:00:24 2011
@@ -30,13 +30,9 @@ module Shell
       end
 
       def refresh_width()
-        @max_width = Java::jline.Terminal.getTerminal().getTerminalWidth()
-
-        # the above doesn't work in some terminals
-        # (such as shell running within emacs)
-        if @max_width == 0
-          @max_width = 100
-        end
+        @max_width = Java::jline.Terminal.getTerminal().getTerminalWidth() if $stdout.tty?
+        # the above doesn't work in some terminals (such as shell running within emacs)
+        @max_width = 100 if @max_width.to_i.zero?
       end
 
       # Takes an output stream and a print width.