Skip to content

Instantly share code, notes, and snippets.

@andyl
Created May 1, 2011 17:50
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andyl/950681 to your computer and use it in GitHub Desktop.
Save andyl/950681 to your computer and use it in GitHub Desktop.
def run_in_background(&block)
Process.fork do
Process.fork do
puts "Launching Background Process"
Daemons.call &block
puts "Background Process has been Launched"
end
exit
end
end
get '/first' do
puts "start FIRST action"
run_in_background {puts "HI"; sleep 20; puts "BYE"; }
puts "finish FIRST action"
redirect("/second")
end
get '/second' do
"This is the SECOND action<br/><a href='/first'>go to first</a>"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment