Consider the following Ruby code
sleep 10
puts "Foo is #{ENV['foo']}"
Saving this file to envtest.rb
Running this from the shell:
export foo=bar
ruby envtest.rb &
export foo=baz
( ... 10 seconds later ... )
=> Foo is bar
It appears that the environment is evaluated when the ruby interpreter is launched. Is it possible to update environment variables during execution and have those changes reflected in running processes? If so, how?