From 0e7326b1331bec33495b935252f01a21621c8275 Mon Sep 17 00:00:00 2001 From: guyueshui Date: Tue, 19 Nov 2024 19:27:29 +0800 Subject: [PATCH] Correct the exit value on abort (#3321) `flameshot gui` exits with 0 on abort, we can use the return value of `qApp->exec()` in `requestCaptureAndWait`. --- src/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 23d3157e01..80ffb31dc7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,7 +45,7 @@ void wayland_hacks() } #endif -void requestCaptureAndWait(const CaptureRequest& req) +int requestCaptureAndWait(const CaptureRequest& req) { Flameshot* flameshot = Flameshot::instance(); flameshot->requestCapture(req); @@ -66,7 +66,7 @@ void requestCaptureAndWait(const CaptureRequest& req) AbstractLogger::info() << "Screenshot aborted."; qApp->exit(1); }); - qApp->exec(); + return qApp->exec(); } QSharedMemory* guiMutexLock() @@ -428,7 +428,7 @@ int main(int argc, char* argv[]) req.addSaveTask(); } } - requestCaptureAndWait(req); + return requestCaptureAndWait(req); } else if (parser.isSet(fullArgument)) { // FULL reinitializeAsQApplication(argc, argv); @@ -463,7 +463,7 @@ int main(int argc, char* argv[]) if (!clipboard && path.isEmpty() && !raw && !upload) { req.addSaveTask(); } - requestCaptureAndWait(req); + return requestCaptureAndWait(req); } else if (parser.isSet(screenArgument)) { // SCREEN reinitializeAsQApplication(argc, argv); @@ -513,7 +513,7 @@ int main(int argc, char* argv[]) req.addSaveTask(); } - requestCaptureAndWait(req); + return requestCaptureAndWait(req); } else if (parser.isSet(configArgument)) { // CONFIG bool autostart = parser.isSet(autostartOption); bool filename = parser.isSet(filenameOption);