diff options
author | 0xAB <0xAB@protonmail.com> | 2017-09-02 16:02:44 +0100 |
---|---|---|
committer | 0xAB <0xAB@protonmail.com> | 2017-09-02 16:02:44 +0100 |
commit | 638ad6b30e29af1993007d331f40682b7d714613 (patch) | |
tree | ce362d72282b6800dd86b8e9b3c3f2515b1eea96 | |
parent | c988595b65e415f518c68dea872db02eb8c20082 (diff) | |
download | pry-638ad6b30e29af1993007d331f40682b7d714613.tar.gz |
spawn ruby without a shell.
jruby speeds seem bareable now.
-rw-r--r-- | lib/pry/helpers/text.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/pry/helpers/text.rb b/lib/pry/helpers/text.rb index bd9af9ff..8fbd992f 100644 --- a/lib/pry/helpers/text.rb +++ b/lib/pry/helpers/text.rb @@ -80,13 +80,16 @@ class Pry # def displayable_string?(str) require 'open3' if not defined?(Open3) - Open3.popen3 DISPLAY_CMD % {ruby: RbConfig.ruby, - str: str, - impl_specific_options: jruby? ? "--dev --client --disable=gems --disable=did_you_mean" : ""} do |_,out,_| + variables = { + str: str, + impl_specific_options: jruby? ? "--dev --client --disable=gems --disable=did_you_mean" : "" + } + args = Shellwords.shellsplit(DISPLAY_CMD % variables) + Open3.popen3({}, [RbConfig.ruby, "pry-#{__method__}"], *args) do |_,out,_,_| str == out.gets.chomp end end - DISPLAY_CMD = %q("%{ruby}" %{impl_specific_options} --disable-gems -e 'print "%{str}"').freeze + DISPLAY_CMD = %q(%{impl_specific_options} --disable-gems -e 'print "%{str}"').freeze SNOWMAN = "☃".freeze private_constant :DISPLAY_CMD, :SNOWMAN |