SHTK_ABORT(3)

πŸ“¦ version 1.7, in nixos 26.05, nixpkgs unstable

✨ SHTK_ABORT(3) ✨

okay bestie, buckle up, because today we're talking about shtk_abort from the shtk library functions manual and honestly? it's giving "dramatic exit" energy and i'm kind of obsessed πŸ’…


🌸 NAME 🌸

shtk_abort β€” aborts the program with an optional error message, no cap, it just straight up ends things πŸ’€


πŸŽ€ SYNOPSIS πŸŽ€

shtk_abort [message1 .. messageN]

πŸ¦‹ DESCRIPTION πŸ¦‹

so the shtk_abort function prints whatever error message you hand it over to stderr and then terminates execution of the script β€” and not just the main script, bestie, it takes out all the subshells leading up to the call to shtk_abort too. like, the whole family tree. 😭

the exit code of the script is non-zero but unspecified β€” so yes it's a fail, but don't @ me asking which fail, because it does not say. πŸ™ˆ

the message, if you even provide one, can be broken up into one or more arguments, which is what message1 through messageN are about ✨ β€” all of those arguments get concatenated together into a single line. so go ahead and split your sentence up across args, it'll come out as one pretty line in the end 🫢

πŸ’– important note incoming: shtk_abort should be used exclusively to abruptly abort the script because of an internal error or inconsistency. think of this function as your mechanism for implementing assertions, iykyk:
[ -n "${should_be_set}" ] || shtk_abort "Internal variable not set!"

and this is exactly why shtk_abort is not in the shtk_cli(3) module, bestie β€” because it is not meant to provide a mechanism for clean program terminations, and because it is provided for self-diagnostics purposes. it's the "something is deeply wrong, we ride at dawn (to the exit)" function, not the "we finished tidily, bye" function. periodt. πŸ‘‘


🌈 SEE ALSO 🌈


⭐ HISTORY ⭐

shtk_abort first appeared in shtk 1.7 ✨ iconic debut honestly.


and that's the whole page, babe πŸ’œ this little gem comes to you from the Debian crew, dated September 14, 2016 β€” so yes, it's been slaying in the shtk 1.7 era since way back πŸŽ€ go forth and abort responsibly (internal errors only, fr fr) πŸ¦‹

πŸ“¦ where this page comes from