Skip to content

Commit

Permalink
Use the system ruby when the environment is empty in #spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Aug 19, 2016
1 parent 77132b3 commit 641bc01
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions shared/process/spawn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,19 @@

# :unsetenv_others

# Use the system ruby when the environment is empty as it could easily break launchers.

it "unsets other environment variables when given a true :unsetenv_others option" do
ENV["FOO"] = "BAR"
lambda do
Process.wait @object.spawn('env', unsetenv_others: true)
Process.wait @object.spawn(['ruby', fixture(__FILE__, "env.rb")], unsetenv_others: true)
end.should output_to_fd("")
end

it "unsets other environment variables when given a non-false :unsetenv_others option" do
ENV["FOO"] = "BAR"
lambda do
Process.wait @object.spawn('env', unsetenv_others: :true)
Process.wait @object.spawn(['ruby', fixture(__FILE__, "env.rb")], unsetenv_others: :true)
end.should output_to_fd("")
end

Expand All @@ -255,7 +257,7 @@

it "does not unset environment variables included in the environment hash" do
lambda do
Process.wait @object.spawn({"FOO" => "BAR"}, 'env', unsetenv_others: true)
Process.wait @object.spawn({"FOO" => "BAR"}, ['ruby', fixture(__FILE__, "env.rb")], unsetenv_others: true)
end.should output_to_fd("FOO=BAR\n")
end

Expand Down

0 comments on commit 641bc01

Please sign in to comment.