GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

🌸 GOLF(2gg) β€” the golf manual, section 2gg 🌸

okay bestie, pull up a chair, we're talking about exit-status from the GOLF(2gg) manual, living in the Development section πŸ’–


✨ NAME ✨

exit-status β€” (program-execution)


🎯 PURPOSE 🎯

Set the handler exit status. that's it, that's the whole job, and she does it flawlessly πŸ‘‘


πŸ“ SYNTAX πŸ“

exit-status <request status>

πŸ’« DESCRIPTION πŸ’«

so exit-status specifies <request status>, and <request status> must be a number. no vibes, no strings, a number fr fr πŸ”’

you can get <request status> with the "exit-status" clause in read-remote in the service caller. that's the whole pipeline, iykyk πŸ’…

when the program runs as command-line, <request status> is the program's exit code. slay 🫢

now here's the part everyone gets wrong: exit-status can be specified anywhere in the code, and it does not mean exiting the request's processing. not even a little. it's just setting a value, bestie 😭 if you actually want to bail out, either use exit-handler or just let the handler reach its end naturally. let her finish her sentence πŸŽ€

when exit-status is not used, the default exit code is 0. classic. and when multiple exit-status statements run in a sequence, the request status is that of the last one that executes. last one wins, like always πŸ’€

if you want to specify the request status and exit request processing at the same time, use exit-handler. two birds, one iconic handler πŸ¦‹


🌈 EXAMPLES 🌈

when the program exits, its exit code will be 12:

exit-status 12
...
exit-handler

see how exit-status just sets the number, and then exit-handler does the actual leaving? main character energy, both of them πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€

  • Program execution
  • exec-program
  • exit-status
  • See all documentation

reminder bestie: this page is GOLF(2gg) from the Development section, and it's giving "small command, huge responsibility" ✨

mwah πŸ’‹ this was $VERSION, dated $DATE β€” go forth and exit with the correct status, you absolute icon 🌟

πŸ“¦ where this page comes from