drogon
drogon copied to clipboard
catch SIGINT signal
Notice If you need support or clarification regarding the usage of Drogon in your project, visit the official Drogon support channel at gitter
Please create a new issue only if you think you have found a bug or if have a feature request/enhancement.
Is your feature request related to a problem? Please describe. It would be nice if Drogon would catch the SIGINT and allowed me to run a subroutine.
Describe the solution you'd like catch SIGINT and end program without warnings.
Describe alternatives you've considered I am not sure how to do this in c but in a shell script I would run something like trap on SIGINT.
Additional context
Drogon has this member function:
HttpAppFramework &setIntSignalHandler(
const std::function<void()> &handler)
I never try, but something like this should work:
app().setIntSignalHandler(my function);
or even
app().setIntSignalHandler([&]{std::cerr << "Alarm! SIGINT!";});
I added this to main but I am still seeing the warning. Is there a way to get rid of the warning?
Also I have a follow up question, after I print out std::cout "good bye" how can I exit. I tried exit and return 0 to no avail. How do I get my terminal back. Please advice. Thanks.
Would you like drogon stop running and exit? I suppose app().quit();
will do this work (stop all threads , plugins and return to main (where you called it from))
Perfect! That worked thanks.