diff options
Diffstat (limited to 'spec/support/helpers.rb')
-rw-r--r-- | spec/support/helpers.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 0d4d2d53c8..f0803453d2 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -72,7 +72,7 @@ module Spec begin #{ruby} rescue LoadError => e - $stderr.puts "ZOMG LOAD ERROR" if e.message.include?("-- #{name}") + warn "ZOMG LOAD ERROR" if e.message.include?("-- #{name}") end RUBY opts = args.last.is_a?(Hash) ? args.pop : {} @@ -156,9 +156,8 @@ module Spec def ruby(ruby, options = {}) env = options.delete(:env) || {} - ruby = ruby.gsub(/["`\$]/) {|m| "\\#{m}" } lib_option = options[:no_lib] ? "" : " -I#{lib_dir}" - sys_exec(%(#{Gem.ruby}#{lib_option} -w -e "#{ruby}"), env) + sys_exec(%(#{Gem.ruby}#{lib_option} -w -e #{ruby.shellescape}), env) end bang :ruby @@ -167,7 +166,7 @@ module Spec begin #{ruby} rescue LoadError => e - $stderr.puts "ZOMG LOAD ERROR"# if e.message.include?("-- #{name}") + warn "ZOMG LOAD ERROR" if e.message.include?("-- #{name}") end R end @@ -194,7 +193,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 |