Merge lp:~ken-vandine/address-book-app/graceful_quit into lp:address-book-app

Proposed by Ken VanDine
Status: Approved
Approved by: Renato Araujo Oliveira Filho
Approved revision: 403
Proposed branch: lp:~ken-vandine/address-book-app/graceful_quit
Merge into: lp:address-book-app
Diff against target: 32 lines (+13/-0)
1 file modified
src/app/main.cpp (+13/-0)
To merge this branch: bzr merge lp:~ken-vandine/address-book-app/graceful_quit
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+253556@code.launchpad.net

Commit message

Gracefully quit on SIGTERM, SIGHUP, SIGKILL, and SIGINT

Description of the change

Gracefully quit on SIGTERM, SIGHUP, SIGKILL, and SIGINT

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

looks good. Thanks

review: Approve

Unmerged revisions

403. By Ken VanDine

Gracefully quit on SIGTERM, SIGHUP, SIGKILL, and SIGINT

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/main.cpp'
2--- src/app/main.cpp 2014-02-18 14:09:02 +0000
3+++ src/app/main.cpp 2015-03-19 18:03:41 +0000
4@@ -17,9 +17,17 @@
5 #include "config.h"
6 #include "addressbookapp.h"
7
8+#include <csignal>
9 // Qt
10 #include <QCoreApplication>
11
12+namespace {
13+ void shutdown(int sig)
14+ {
15+ QCoreApplication::instance()->quit();
16+ }
17+}
18+
19 int main(int argc, char** argv)
20 {
21 QCoreApplication::setOrganizationName("Canonical");
22@@ -32,6 +40,11 @@
23 return 0;
24 }
25
26+ std::signal(SIGTERM, shutdown);
27+ std::signal(SIGHUP, shutdown);
28+ std::signal(SIGKILL, shutdown);
29+ std::signal(SIGINT, shutdown);
30+
31 return application.exec();
32 }
33

Subscribers

People subscribed via source and target branches