use Process.wait to wait for all child processes to finish before continuing. : Process « Development « Ruby






use Process.wait to wait for all child processes to finish before continuing.


child = fork do
  sleep 3
  puts "Child says 'hi'!"
end

puts "Waiting for the child process..."
Process.wait child
puts "All done!"

 








Related examples in the same category

1.Daemon Processes
2.Use Process.kill
3.Process.pid and Process.ppid