mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
(maint) Enable Ctrl-C to kill all threads in developer environment
Previously, if you ran the vpooler via ruby, pressing Ctrl-C would terminate the Webserver however the PoolManager does not have a handler and would instead just keep executing. This commit adds a global Ctrl-C hook which terminates both the api and manager threads. This behaviour will only be enabled if the `VMPOOLER_DEBUG` environment variable exists so that it does not affect VMPooler when running in production environments.
This commit is contained in:
parent
80c0742e80
commit
8f294c055e
1 changed files with 7 additions and 0 deletions
7
vmpooler
7
vmpooler
|
|
@ -26,4 +26,11 @@ manager = Thread.new {
|
|||
).execute!
|
||||
}
|
||||
|
||||
if ENV['VMPOOLER_DEBUG']
|
||||
trap("INT") {
|
||||
puts "Shutting down."
|
||||
[api, manager].each { |t| t.exit }
|
||||
}
|
||||
end
|
||||
|
||||
[api, manager].each { |t| t.join }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue