Thread (69 messages) 69 messages, 6 authors, 2025-06-06

Re: [PATCH v3 10/12] usage: allow dying without writing an error message

From: Karthik Nayak <hidden>
Date: 2025-06-03 08:31:02

Patrick Steinhardt [off-list ref] writes:
Sometimes code wants to die in a situation where it already has written
an error message. To use the same error code as `die()` we have to open
code the code with a call to `exit(128)` in such cases, which is easy to
Nit: This reads a little weird.
get wrong and leaves magical numbers all over our codebase.

Teach `die_message_builtin()` to not print any error when passed a
`NULL` pointer as error string. Like this, such users can now call
`die(NULL)` to achieve the same result without any hardcoded error
codes.

Adapt a couple of builtins to use this new pattern to demonstrate that
there is a need for such a helper.
[snip]

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help