-
Notifications
You must be signed in to change notification settings - Fork 3
Exiting from pre_run hooks #13
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededquestionFurther information is requestedFurther information is requested
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededquestionFurther information is requestedFurther information is requested
For
pre_runhook methods, there is the option to stop command execution to the mainrunmethod if the value returned isfalse. However, there are no checks in place to determine the actual exit code for this, theExecutorsimply 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_errorhook 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 theCommandclass.