Last active
April 6, 2019 02:02
-
-
Save iloveitaly/7d16735ad395ea1399e8d115b4295aa2 to your computer and use it in GitHub Desktop.
Example application to inspect how heroku handles parent-child process signaling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby '2.2.3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GEM | |
specs: | |
PLATFORMS | |
ruby | |
DEPENDENCIES | |
RUBY VERSION | |
ruby 2.2.3p173 | |
BUNDLED WITH | |
1.13.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: bundle exec ruby worker.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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