Author: nspiegelberg
Date: Tue Sep 27 02:41:24 2011
New Revision: 1176173
URL: http://svn.apache.org/viewvc?rev=1176173&view=rev
Log:
hbase shell commands hang in some terminals (such as shell within emacs)
Summary:
Java::jline.Terminal.getTerminal().getTerminalWidth()
returns 0 for some terminals. This causes code to
get into a inf loop, and eventually run out of JVM memory.
Reviewed By: kranganathan
Test Plan: ran hbase/shell commands that were failing before (such as list,
describe) from within emacs.
Revert Plan: ok
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=1176173&r1=1176172&r2=1176173&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/ruby/shell/formatter.rb (original)
+++ hbase/branches/0.89/src/main/ruby/shell/formatter.rb Tue Sep 27 02:41:24
2011
@@ -31,6 +31,12 @@ module Shell
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
end
# Takes an output stream and a print width.