Process.spawn is supposed to unset environment variables that are explicitly specified as nil. Instead, the environment variable is being set as "". This happens even if the environment variable didn't exist before calling Process.spawn.
Below is a sample script demonstrating the problem:
#!/usr/bin/env ruby
if ARGV.first != "spawned"
Process.wait Process.spawn({ "SHOULD_BE_NIL" => nil }, __FILE__, "spawned")
exit
end
if ENV["SHOULD_BE_NIL"].nil?
puts "success!"
else
puts "failure: #{ENV["SHOULD_BE_NIL"].inspect}"
end
When run on Ruby 2.2.3 and JRuby 1.7.22, it works as expected... I get success!, but on JRuby 9.0.3.0, I get failure: "".
I'd be happy to work on a fix for this if it hasn't already been solved (I found some similar looking issues open, but couldn't find one that quite matched it).
Process.spawnis supposed to unset environment variables that are explicitly specified asnil. Instead, the environment variable is being set as"". This happens even if the environment variable didn't exist before callingProcess.spawn.Below is a sample script demonstrating the problem:
When run on
Ruby 2.2.3andJRuby 1.7.22, it works as expected... I getsuccess!, but onJRuby 9.0.3.0, I getfailure: "".I'd be happy to work on a fix for this if it hasn't already been solved (I found some similar looking issues open, but couldn't find one that quite matched it).