Feature: support Int return from main in compiled programs for Unix exit codes #355
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
rust
technical-debt
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-seq#355
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
Script mode already supports
main ( -- Int )so that exit codes work correctly with bash and other shell scripts. Compiled programs currently only supportmain ( -- ).Request
Allow compiled programs to also use
main ( -- Int )to return an exit code, mirroring script mode behaviour:This would encourage good Unix etiquette — programs that exit with meaningful codes can be composed with
&&,||,$?,set -e, etc.Proposed behaviour
main ( -- )continues to work (exits with code 0)main ( -- Int )uses the return value as the process exit codeNotes
Script mode already implements this. The compiled path just needs the same treatment at the entry point.
while arguably a feature request, I'm viewing this as a very bad bug to be fixed via https://github.com/navicore/patch-seq/blob/main/docs/design/MAIN_EXIT_CODE.md
https://github.com/navicore/patch-seq/pull/397