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

Don't use die when exiting successfully #253

Closed
lorenzleutgeb opened this issue Jan 28, 2022 · 2 comments · Fixed by #254
Closed

Don't use die when exiting successfully #253

lorenzleutgeb opened this issue Jan 28, 2022 · 2 comments · Fixed by #254

Comments

@lorenzleutgeb
Copy link
Contributor

lorenzleutgeb commented Jan 28, 2022

I was very surprised to get non-zero exit codes for these invocations:

> latexdiff-vc --version ; echo $?
This is LATEXDIFF-VC 1.3.1.1
  (c) 2005-2020 F J Tilmann
255
> latexdiff --version ; echo $?
This is LATEXDIFF 1.3.1.1 (Algorithm::Diff 1.15 so, Perl v5.34.0)
  (c) 2004-2020 F J Tilmann
255

It turns out that you use die to print the version string and exit:

die $versionstring ;

However, die sets a non-zero exit code, indicating an error. When printing the version string is everything that the program should do, then I'd also expect it to exit with an exit code of zero once that's done.

The documentation for die states:

If you need to exit the process with a specific exit code, see exit.

IMO, print followed by exit should be used, like here:

latexdiff/latexdiff

Lines 490 to 491 in af22466

print STDERR $versionstring ;
exit 0;

@ftilmann
Copy link
Owner

Thanks for reporting. This seems a duplicate of #248 and should be fixed on master (and actually in the very latest release, which was made just after). I will close. Let me know if there is still a problem.

@lorenzleutgeb
Copy link
Contributor Author

lorenzleutgeb commented Jan 28, 2022

Yes, sorry for duplicating, and thanks for fixing that issue, but as of 2022-01-28 master points at af22466 which I am referring to. It seems that you missed latexdiff-vc. Please fix and/or reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants