Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flameshot gui exits with 0 on abort #3321

Open
cyqsimon opened this issue Aug 31, 2023 · 5 comments
Open

flameshot gui exits with 0 on abort #3321

cyqsimon opened this issue Aug 31, 2023 · 5 comments
Labels
Bug It's a bug CLI CLI specific Good first issue Issues labeled as such are a good way to get use to the codebase. Ask for help if needed. Reproduced The reported issue was reproduced in a clean VM

Comments

@cyqsimon
Copy link

cyqsimon commented Aug 31, 2023

Flameshot Version

Flameshot v12.1.0 (-)
Compiled with Qt 5.15.5

Installation Type

Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...)

Operating System type and version

EndeavourOS, Linux 6.4.12-arch1-1 x86_64

Description

I was trying to use flameshot in scripting, and was surprised to find that flameshot gui does not exit with non-zero status when user aborts. This makes scripting quite a bit more annoying.

The behaviour I expected is to exit with 1 (or whatever) on abort.

Steps to reproduce

  1. Run flameshot gui in terminal
  2. Hit esc to abort
  3. Run echo $?, notice that the status is 0

Screenshots or screen recordings

No response

System Information

Operating System: EndeavourOS
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10
Kernel Version: 6.4.12-arch1-1 (64-bit)
Graphics Platform: X11

@cyqsimon cyqsimon added the Unconfirmed Bug The bug is not confirmed by anyone else. label Aug 31, 2023
@muzilong
Copy link

same problem

@mmahmoudian mmahmoudian added Bug It's a bug CLI CLI specific Good first issue Issues labeled as such are a good way to get use to the codebase. Ask for help if needed. Reproduced The reported issue was reproduced in a clean VM and removed Unconfirmed Bug The bug is not confirmed by anyone else. labels Nov 6, 2023
@Monirzadeh
Copy link
Contributor

Monirzadeh commented Dec 30, 2023

if i use std::exit(1); to bellow part problem can be solve.

flameshot/src/main.cpp

Lines 65 to 68 in 3d21e49

QObject::connect(flameshot, &Flameshot::captureFailed, []() {
AbstractLogger::info() << "Screenshot aborted.";
qApp->exit(1);
});

is there any specific reason that i should avoid that and force us to use qApp->exit(1);?

@serebryakov02
Copy link

Question for the developers: How can I run Flameshot from the terminal using the source code? When I launch it from Qt Creator and follow the instructions, I do not receive any messages. However, if I download Flameshot as a standalone program and launch it according to the instructions, I can reproduce.

@Monirzadeh
Copy link
Contributor

you should follow this guide than run flameshot in build directory

guyueshui added a commit to guyueshui/flameshot that referenced this issue Nov 19, 2024
`flameshot gui` exits with 0 on abort, we can use the return value of `qApp->exec()` in `requestCaptureAndWait`.
@guyueshui
Copy link

guyueshui commented Nov 19, 2024

Since this issue is marked as "Good first issue" by member of flameshot, and I've used flameshot for quite a while and am happy to make some contributions if possible. So I tried read the code and found this simple solution, hope it helps.

Please let me know if I was wrong, this is my first pull request (#3786) on my life though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It's a bug CLI CLI specific Good first issue Issues labeled as such are a good way to get use to the codebase. Ask for help if needed. Reproduced The reported issue was reproduced in a clean VM
Projects
None yet
Development

No branches or pull requests

6 participants