From 8d2a766a4396963ec2bcb8724c2d6e720e509d56 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Sun, 18 Nov 2012 00:13:44 -0800 Subject: [PATCH] Work around bug in jruby 1.7 on JVM 7 on Linux [Fixes #732] OHAI LEAKY ABSTRACTIONS --- lib/pry/core_extensions.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/pry/core_extensions.rb b/lib/pry/core_extensions.rb index 608e100d..88acd17f 100644 --- a/lib/pry/core_extensions.rb +++ b/lib/pry/core_extensions.rb @@ -119,3 +119,15 @@ if [[1, 2]].pretty_inspect == "[1]\n" end end end + +if defined?(JRUBY_VERSION) && JRUBY_VERSION == "1.7.0" + require 'io/console' + class IO + def winsize + stty_info = `stty -a` + match = stty_info.match(/(\d+) rows; (\d+) columns/) # BSD version of stty, like the one used in Mac OS X + match ||= stty_info.match(/; rows (\d+); columns (\d+)/) # GNU version of stty, like the one used in Ubuntu + [match[1].to_i, match[2].to_i] + end + end +end