Skip to content

Instantly share code, notes, and snippets.

@simsicon
Created September 22, 2013 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simsicon/6657720 to your computer and use it in GitHub Desktop.
Save simsicon/6657720 to your computer and use it in GitHub Desktop.
ENV will inherit content from parent, not disturbed by siblings.
ENV['p_name'] = 'master'
puts "[master] pid: #{Process.pid} pname: #{ENV['p_name']}"
p1 = Process.fork{
puts "[p1] pid: #{Process.pid} pname: #{ENV['p_name']}"
ENV['p_name'] = 'p1'
puts "[p1] pid: #{Process.pid} pname: #{ENV['p_name']}"
}
p2 = Process.fork{
puts "[p2] pid: #{Process.pid} pname: #{ENV['p_name']}"
ENV['p_name'] = 'p2'
puts "[p2] pid: #{Process.pid} pname: #{ENV['p_name']}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment