summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0xAB <0xAB@protonmail.com>2017-09-02 15:02:11 +0100
committer0xAB <0xAB@protonmail.com>2017-09-02 15:03:05 +0100
commitc01f3deac100e1dbb737c40f6081fbb3d8a04e8e (patch)
tree62c1a701ad663e4289db4009054139e9fc250a81
parent49e76f2b88442ca273c6c9edf9beae47b6222557 (diff)
downloadpry-c01f3deac100e1dbb737c40f6081fbb3d8a04e8e.tar.gz
optimise displayable_{char,string}? on JRuby.
still slow.
-rw-r--r--lib/pry/helpers/text.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/pry/helpers/text.rb b/lib/pry/helpers/text.rb
index 0ad53aa9..c88d9783 100644
--- a/lib/pry/helpers/text.rb
+++ b/lib/pry/helpers/text.rb
@@ -80,11 +80,13 @@ class Pry
#
def displayable_string?(str)
require 'open3' if not defined?(Open3)
- Open3.popen3 DISPLAY_CMD % {ruby: RbConfig.ruby, str: str} do |_, stdout, _|
- str == stdout.gets.chomp
+ Open3.popen3 DISPLAY_CMD % {ruby: RbConfig.ruby,
+ str: str,
+ impl_specific_options: jruby? ? "--dev --client" : ""} do |_,out,_|
+ str == out.gets.chomp
end
end
- DISPLAY_CMD = %q("%{ruby}" -e 'print "%{str}"').freeze
+ DISPLAY_CMD = %q("%{ruby}" %{impl_specific_options} --disable-gems -e 'print "%{str}"').freeze
SNOWMAN = "☃".freeze
private_constant :DISPLAY_CMD, :SNOWMAN