summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-01-03 21:13:50 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2020-01-05 17:35:56 +0100
commit42f5b02859cbb5e271752bd9fbae56100de0bd8c (patch)
tree4a76693a852f46172321f31ae8cc5a9546df23c7
parent3154968f29cf9c2c31cdf94cf4fc90d89c5215da (diff)
downloadbundler-42f5b02859cbb5e271752bd9fbae56100de0bd8c.tar.gz
Avoid spawning a new shell with Open3.popen3
So that we don't need to manually escape `$`, that seems to give trouble on Windows.
-rw-r--r--spec/support/helpers.rb5
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