-
Notifications
You must be signed in to change notification settings - Fork 200
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
Bug/Feature Request: Exit Code documentation/implementation #284
Comments
Ideally we'd pick more sensible/consistent exit codes while at it… |
Looking through a few wikis, manpages, and POSIX specs, besides C only allowing an 8-bit integer return and POSIX only looking at 8 bits in most cases anyways, there's only really two common semantics for use beyond
I personally like the set of error codes that BSD defines, but it really just needs to be documented, whatever is used -- likely defined as macros in some header file. The main point of exit codes is for a calling program to know the exit status anyways, not really humans (that's what we have logs and For what's already used for errors, I can see classifying them (and so giving different error codes) in at least these ways:
Broadly, they're probably just:
Also is that a stray semicolon in pam.c? I'm not super familiar with the undefined C behavior stuff. EDIT: Had to fix the file links. Works differently than I expected |
I'd just use 1 everywhere tbh. No good reason why users would want to tell apart these. |
Most of the time, yes, the specific exit code isn't important. The main time you really need it though is when you fork/manage it via another process. My particular need is for running the application as a Systemd (oneshot) service, where I need to differentiate why a program exited -- so that for certain types of errors, the program is restarted, but isn't for other, more critical ones. If nothing else, it could be set to |
Whichever strategy is preferable, I can probably implement it in a PR myself if you'd like |
As written, swaylock will exit one of four different values:
0
,1
,2
,EXIT_SUCCESS
, andEXIT_FAILURE
, where the last two are undefined POSIX values that I believe GNU/Linux, BSD, and LLVM map to0
and1
respectively (supposedly VMS does something else, andEXIT_FAILURE
could be -1 according to the FreeBSD manpage).So far as I can tell,
2
is used when unable to lock with the legacy wayland API due to that lock being held (likely by another lockscreen), the display dispatch failing, and readiness notification failures.0 being used as "success" in the sense of daemonization (hopefully) checking, no caught errors (excepting config reads... which always succeed) and PAM/shadow success.
Everything else (all errors) maps to 1.
Can we possibly get this documented in the manpage?
The text was updated successfully, but these errors were encountered: