« Return to Thread: [Q] how can I start a shell process and return immediately?

Re: how can I start a shell process and return immediately?

by 7stud -- :: Rate this Message:

Reply to Author | View in Thread

r8test.rb
-------
sleep(4)
puts  "Data from subprocess: 10 20 30"



main_program.rb
--------------
puts "main program"
sleep(1)

pipe = IO.popen("ruby r8test.rb", "w+")

puts "main program executing while subprocess is sleeping"
Process.wait

pipe.close_write
puts pipe.gets

pipe.close_read
--
Posted via http://www.ruby-forum.com/.

 « Return to Thread: [Q] how can I start a shell process and return immediately?