HBASE-3781 hbase shell cannot start NoMethodError: undefined method 'close' for nil:NilClass

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1094711 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-04-18 19:46:29 +00:00
parent 44e5935e0d
commit 879ff4a39c
2 changed files with 11 additions and 1 deletions

View File

@ -76,6 +76,8 @@ Release 0.91.0 - Unreleased
HBASE-3758 Delete triggers pre/postScannerOpen upcalls of RegionObserver
(Mingjie Lai via garyh)
HBASE-3790 Fix NPE in ExecResult.write() with null return value
HBASE-3781 hbase shell cannot start "NoMethodError: undefined method
`close' for nil:NilClass" (Mikael Sitruk)
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -17,8 +17,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'rbconfig'
module IRB
WINDOZE = Config::CONFIG['host_os'] =~ /mswin|mingw/
# Map the '/dev/null' according to the runing platform
# Under Windows platform the 'dev/null' is not fully compliant with unix,
# and the 'NUL' object need to be use instead.
# Subclass of IRB so can intercept methods
class HIRB < Irb
def initialize
@ -31,7 +37,9 @@ module IRB
# happen is the shell exiting because of failed IRB construction with
# no error (though we're not blanking STDERR)
begin
f = File.open("/dev/null", "w")
devnull = "/dev/null"
devnull = "NUL" if WINDOZE
f = File.open(devnull, "w")
$stdout = f
super
ensure