Exiting from pre_run
hooks
#13
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
question
Further information is requested
For
pre_run
hook methods, there is the option to stop command execution to the mainrun
method if the value returned isfalse
. However, there are no checks in place to determine the actual exit code for this, theExecutor
simply returns which results in a 0 exit code:cling/src/cling/executor.cr
Lines 52 to 54 in 279db9a
This is obviously not ideal and even misleading for people designing applications that rely on the exit code for debugging or informational purposes. There are already ways to get around this, for example, raising a specific exception that gets funneled to the
on_error
hook method which then terminates the program with the appropriate exit code. But I think there should be a better way of doing this, even if it's just a shorthand method built into theCommand
class.The text was updated successfully, but these errors were encountered: