You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
As far as I am aware, there is no way to have a Unison program exit with a specified exit code.
Describe the solution you'd like
My preference would be to have main-like functions return an integer, since that allows for composable mains (as opposed to something like an unhandleable IO.exit effect). Having a 'set exit code' or 'quit now with exit code' be part of the IO ability would also be acceptable. Or a special type of Failure. Or a new ability. Maybe call it Quit Int.
It is the kind of thing I often want to handle, though, because I don't necessarily want to force the OS process to quit. e.g. just because my program does an exit 1 doesn't mean I want ucm.exe to stop. What I want is not so much about stopping the process as providing an exit code from main, which if it happens to be the top-level function, should cause the containing process to exit with the code I gave.
/me grumbles about always writing wrapper functions to avoid writing System.exit(1)
Describe alternatives you've considered
Current workaround is to throw an exception. This doesn't allow for exit codes other than 0 (return normally) or 1 (throw exception), and results in Unison printing out some additional information that I didn't necessarily want to show.
Is your feature request related to a problem? Please describe.
As far as I am aware, there is no way to have a Unison program exit with a specified exit code.
Describe the solution you'd like
My preference would be to have
main
-like functions return an integer, since that allows for composable mains (as opposed to something like an unhandleableIO.exit
effect). Having a 'set exit code' or 'quit now with exit code' be part of the IO ability would also be acceptable. Or a special type of Failure. Or a new ability. Maybe call itQuit Int
.It is the kind of thing I often want to handle, though, because I don't necessarily want to force the OS process to quit. e.g. just because my program does an
exit 1
doesn't mean I wantucm.exe
to stop. What I want is not so much about stopping the process as providing an exit code from main, which if it happens to be the top-level function, should cause the containing process to exit with the code I gave./me grumbles about always writing wrapper functions to avoid writing
System.exit(1)
Describe alternatives you've considered
Current workaround is to throw an exception. This doesn't allow for exit codes other than 0 (return normally) or 1 (throw exception), and results in Unison printing out some additional information that I didn't necessarily want to show.
Additional context
(from a little proof-of-concept program)
The text was updated successfully, but these errors were encountered: