diff options
-rw-r--r-- | spec/support/helpers.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index e14956f2e9..12d48f6879 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -156,7 +156,7 @@ module Spec def ruby(ruby, options = {}) env = options.delete(:env) || {} - ruby = ruby.gsub(/["`\$]/) {|m| "\\#{m}" } + ruby = ruby.gsub(/["`]/) {|m| "\\#{m}" } lib_option = options[:no_lib] ? "" : " -I#{lib_dir}" sys_exec(%(#{Gem.ruby}#{lib_option} -w -e "#{ruby}"), env) end @@ -194,7 +194,8 @@ module Spec command_execution = CommandExecution.new(cmd.to_s, Dir.pwd) require "open3" - Open3.popen3(env, cmd.to_s) do |stdin, stdout, stderr, wait_thr| + require "shellwords" + Open3.popen3(env, *cmd.shellsplit) do |stdin, stdout, stderr, wait_thr| yield stdin, stdout, wait_thr if block_given? stdin.close |