From 96faa446ab4f82f970e3e1ce4efae8c99ca046e9 Mon Sep 17 00:00:00 2001 From: James LaChance Date: Sat, 15 Dec 2018 14:19:41 -0500 Subject: [PATCH] Exit non-zero when aborting with --raw. This fixes #302. Note that I also added a non-zero exit status when DBus fails to connect. --- src/main.cpp | 6 +++--- src/utils/dbusutils.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 504dd45930..8c590e75f8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) { &QCoreApplication::quit); t.start(); // wait - app.exec(); + return app.exec(); } } else if (parser.isSet(fullArgument)) { // FULL @@ -282,7 +282,7 @@ int main(int argc, char *argv[]) { &QCoreApplication::quit); t.start(); // wait - app.exec(); + return app.exec(); } } else if (parser.isSet(screenArgument)) { // SCREEN @@ -332,7 +332,7 @@ int main(int argc, char *argv[]) { &QCoreApplication::quit); t.start(); // wait - app.exec(); + return app.exec(); } } else if (parser.isSet(configArgument)) { // CONFIG diff --git a/src/utils/dbusutils.cpp b/src/utils/dbusutils.cpp index 87b3c6571c..edb1bde321 100644 --- a/src/utils/dbusutils.cpp +++ b/src/utils/dbusutils.cpp @@ -41,7 +41,7 @@ void DBusUtils::connectPrintCapture(QDBusConnection &session, uint id) { void DBusUtils::checkDBusConnection(const QDBusConnection &connection) { if (!connection.isConnected()) { SystemNotification().sendMessage(tr("Unable to connect via DBus")); - qApp->exit(); + qApp->exit(1); } } @@ -58,6 +58,6 @@ void DBusUtils::captureTaken(uint id, QByteArray rawImage) { void DBusUtils::captureFailed(uint id) { if (m_id == id) { QTextStream(stdout) << "screenshot aborted\n"; - qApp->exit(); + qApp->exit(1); } }