Skip to content

Commit

Permalink
Correct the exit value on abort (flameshot-org#3321)
Browse files Browse the repository at this point in the history
`flameshot gui` exits with 0 on abort, we can use the return value of `qApp->exec()` in `requestCaptureAndWait`.
  • Loading branch information
guyueshui committed Nov 19, 2024
1 parent 729f494 commit 0e7326b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -66,7 +66,7 @@ void requestCaptureAndWait(const CaptureRequest& req)
AbstractLogger::info() << "Screenshot aborted.";
qApp->exit(1);
});
qApp->exec();
return qApp->exec();
}

QSharedMemory* guiMutexLock()
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0e7326b

Please sign in to comment.