Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/runtime/env_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def run_bundler_script(env, script)
create_file("source.rb", <<-RUBY)
print Bundler.original_env["PATH"]
RUBY
path = `getconf PATH`.strip + "#{File::PATH_SEPARATOR}/foo"
path = default_system_path + "#{File::PATH_SEPARATOR}/foo"
with_path_as(path) do
bundle_exec_ruby(bundled_app("source.rb").to_s)
expect(stdboth).to eq(path)
Expand Down Expand Up @@ -49,7 +49,7 @@ def run_bundler_script(env, script)
end
exec(Gem.ruby, __FILE__, (count - 1).to_s)
RUBY
path = `getconf PATH`.strip + File::PATH_SEPARATOR + File.dirname(Gem.ruby)
path = default_system_path + File::PATH_SEPARATOR + File.dirname(Gem.ruby)
with_path_as(path) do
build_bundler_context
bundle_exec_ruby("#{bundled_app("exe.rb")} 2")
Expand Down
6 changes: 6 additions & 0 deletions spec/support/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,12 @@ def with_gem_path_as(path)
end
end

# Windows has no `getconf`, and its current PATH holds the directories the
# Ruby under test finds its DLLs in, so keep it as is there.
def default_system_path
Gem.win_platform? ? ENV["PATH"] : `getconf PATH`.strip
end

def with_path_as(path)
without_env_side_effects do
ENV["PATH"] = path.to_s
Expand Down