Skip to content

Commit d6d6f09

Browse files
authored
Correct the exit value on abort (flameshot-org#3321) (flameshot-org#3786)
`flameshot gui` exits with 0 on abort, we can use the return value of `qApp->exec()` in `requestCaptureAndWait`.
1 parent 10d12e0 commit d6d6f09

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void wayland_hacks()
4545
}
4646
#endif
4747

48-
void requestCaptureAndWait(const CaptureRequest& req)
48+
int requestCaptureAndWait(const CaptureRequest& req)
4949
{
5050
Flameshot* flameshot = Flameshot::instance();
5151
flameshot->requestCapture(req);
@@ -66,7 +66,7 @@ void requestCaptureAndWait(const CaptureRequest& req)
6666
AbstractLogger::info() << "Screenshot aborted.";
6767
qApp->exit(1);
6868
});
69-
qApp->exec();
69+
return qApp->exec();
7070
}
7171

7272
QSharedMemory* guiMutexLock()
@@ -428,7 +428,7 @@ int main(int argc, char* argv[])
428428
req.addSaveTask();
429429
}
430430
}
431-
requestCaptureAndWait(req);
431+
return requestCaptureAndWait(req);
432432
} else if (parser.isSet(fullArgument)) { // FULL
433433
reinitializeAsQApplication(argc, argv);
434434

@@ -463,7 +463,7 @@ int main(int argc, char* argv[])
463463
if (!clipboard && path.isEmpty() && !raw && !upload) {
464464
req.addSaveTask();
465465
}
466-
requestCaptureAndWait(req);
466+
return requestCaptureAndWait(req);
467467
} else if (parser.isSet(screenArgument)) { // SCREEN
468468
reinitializeAsQApplication(argc, argv);
469469

@@ -513,7 +513,7 @@ int main(int argc, char* argv[])
513513
req.addSaveTask();
514514
}
515515

516-
requestCaptureAndWait(req);
516+
return requestCaptureAndWait(req);
517517
} else if (parser.isSet(configArgument)) { // CONFIG
518518
bool autostart = parser.isSet(autostartOption);
519519
bool filename = parser.isSet(filenameOption);

0 commit comments

Comments
 (0)