Issue/pr create: exit with nonzero status code when "Cancel" was chosen#3023
Issue/pr create: exit with nonzero status code when "Cancel" was chosen#3023
Conversation
This is to indicate that the command had not finished successfully.
…mpts Either InterruptErr or SilentErr will be present when the user has chosen "Cancel" or pressed Ctrl-C in prompts. We don't want the recovery mechanism to kick in these cases because the cancellation was likely willingly initiated by the user.
|
@vilmibm I've pushed some tweaks regarding avoiding the PreserveInput mechanism in these cases. Please take a look! |
vilmibm
left a comment
There was a problem hiding this comment.
ah, good catch.
I'm a little nervous about SilentError meaning user cancellation implicitly but am fine with it for now 👍
This also stops printing "interrupt" after Ctrl-C is pressed.
That's a great point. I've now introduced a new concept of "CancelError" which, together with "interrupt" error when Ctrl-C is pressed during Survey, always means explicit user cancellation. For scripts to be able to detect the operation being explicitly cancelled by the user, the |
vilmibm
left a comment
There was a problem hiding this comment.
oh awesome, thank you! I feel much better about this.
Here are the statuses: - 0: success - 1: misc. error - 2: user interrupt/cancellation - 4: authentication needed These old exit codes are now changed to "1": - we used to return "2" for config file errors; - we used to return "2" for alias expansion errors; - we used to return "3" for alias runtime errors. I do not believe that there is a need to distinguish these specific cases via exit status, and converting them to "1" frees codes "2" and "3" for more practical use.
This is to indicate that the command had not finished successfully.
Ref. #3002