summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-13 09:06:05 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-13 09:06:05 +0000
commit6336b394ecdfd57c02504dca8813e3fa5b77151a (patch)
treefd1fae26bc527cbfe7dea7d78c07610f2e561551
parent71f98748a937398f12eb5c333bcb493914096251 (diff)
Fixup r59856. Added workaround for JRuby.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/rdoc/stats/normal.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/rdoc/stats/normal.rb b/lib/rdoc/stats/normal.rb
index ba00b6c..9f7ca59 100644
--- a/lib/rdoc/stats/normal.rb
+++ b/lib/rdoc/stats/normal.rb
@@ -1,5 +1,10 @@
# frozen_string_literal: false
-require 'io/console/size'
+begin
+ require 'io/console/size'
+rescue LoadError
+ # for JRuby
+ require 'io/console'
+end
##
# Stats printer that prints just the files being documented with a progress
@@ -23,7 +28,8 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
# Print a progress bar, but make sure it fits on a single line. Filename
# will be truncated if necessary.
- terminal_width = IO.console_size[1].to_i.nonzero? || 80
+ size = IO.respond_to?(:console_size) ? IO.console_size : IO.console.winsize
+ terminal_width = size[1].to_i.nonzero? || 80
max_filename_size = terminal_width - progress_bar.size
if filename.size > max_filename_size then