Say I have a ruby script called hello_world.rb that has one line
puts "Hello, world"
And I want to call that from another ruby script called spawn_hello_world.rb
pipe = IO.popen("ruby1.9.1 hello_world.rb", 'w+')
if pipe
puts pipe.gets
end
My question is: Is there a shorthand way of running another ruby process without having to call the OS in this way?
I'm aware I could do
pipe = IO.popen('-', 'w+')
which would start another ruby interpreter and I could then send it commands using
pipe.puts "puts "Hello World""
But this seems quite inelegant as well.
I'm basically looking for a ruby equivalent to python's multiprocessing module