run_later with rackup fails to exit with ctrl-c - Ruby

268 Views Asked by At

I'm running a Sinatra application with rackup using this run_later https://github.com/elecklider/sinatra_run_later module (my own fork of https://github.com/pmamediagroup/sinatra_run_later). I can't, however, seem to get it to exit cleanly when I send ctrl-c to rackup. It kicks back with the error ERROR SystemExit: exit on line 38. How can I get it to exit nicely when I close the rackup process?

EDIT:

I've been screwing around with this and the error is raised here:

trap :INT do
  RunLater::Worker.shutdown
  exit # here.
end

And it seems that commenting out the whole trap block gets it to clean up nicely. In essence, this answers the question of how to get it to clean up nicely but I have no idea why so if anyone can offer some clarification I'd really appreciate it.

0

There are 0 best solutions below