Skip to content

Instantly share code, notes, and snippets.

@iloveitaly
Last active April 6, 2019 02:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iloveitaly/7d16735ad395ea1399e8d115b4295aa2 to your computer and use it in GitHub Desktop.
Save iloveitaly/7d16735ad395ea1399e8d115b4295aa2 to your computer and use it in GitHub Desktop.
Example application to inspect how heroku handles parent-child process signaling
ruby '2.2.3'
GEM
specs:
PLATFORMS
ruby
DEPENDENCIES
RUBY VERSION
ruby 2.2.3p173
BUNDLED WITH
1.13.7
web: bundle exec ruby worker.rb
$stdout.sync = true
puts "Parent PID: #{Process.pid}"
trap('TERM') do
puts "parent term"
end
fork do
trap('TERM') do
puts "child term"
end
puts "child PID: #{Process.pid}"
loop { puts "child loop"; sleep 1 }
end
loop { puts "parent loop"; sleep 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment