Reputation: 22404
As explained here, Rails creates a trap for INT signals as soon as it starts.
I have a Rails app that starts up a Sinatra app in a separate thread.
Thread.new do
begin
SinatraApp.run!
rescue => e
puts e.message
end
end
It seems that running the Sinatra app in a separate thread causes my Rails app to no longer respond to INT signals, meaning I can't kill it via CTRL-C. The Sinatra app "steals" all of the INT signals.
How do I fix this? Is it possible to configure my Rails app so that CTRL-C kills both it and the Sinatra app?
Upvotes: 1
Views: 127
Reputation: 22404
My Sinatra app was booting up via WEBrick. I found that using another JRuby-based server instead, like Puma or Trinidad (with the trap
flag set to false
), solved the problem.
This answer helped me find the solution.
Upvotes: 1