Skip to content

local: gracefully fail if the lock is already taken - #321

Merged
gauteh merged 1 commit into
gauteh:masterfrom
laarmen:graceful-non-blocking
Apr 21, 2026
Merged

local: gracefully fail if the lock is already taken#321
gauteh merged 1 commit into
gauteh:masterfrom
laarmen:graceful-non-blocking

Conversation

@laarmen

@laarmen laarmen commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

An EACCES or EAGAIN error on a non-blocking lockf is not actually an error, but rather the program working as intended. At this stage, any other error is unexpected and should probably be left alone.

The tailor-made exception can be caught in our main function to display a short error string and use a specific error code for the user to act accordingly. This is much more user-friendly (and machine-friendly) than the standard python uncaught exception handler.

An EACCES or EAGAIN error on a non-blocking lockf is not actually an
error, but rather the program working as intended. At this stage, any
other error is unexpected and should probably be left alone.

The tailor-made exception can be caught in our main function to display
a short error string and use a specific error code for the user to act
accordingly. This is much more user-friendly (and machine-friendly) than
the standard python uncaught exception handler.
@gauteh

gauteh commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Hi, what's the point of this PR? It seems to just fail with a slightly different error message?

@laarmen

laarmen commented Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

The point of this PR is to differentiate this error, which is a frequent and benign user error. Since it's benign, it shouldn't fill your terminal with a stack trace, and it's nice to have a specific error code (randomly, 7), so that any automation can just deal with it accordingly, e.g. simply suppress it.

@gauteh
gauteh merged commit 8f76442 into gauteh:master Apr 21, 2026
1 of 6 checks passed
@gauteh

gauteh commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Ok. Good, merging.

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 this pull request may close these issues.

2 participants