8000 Return a proper error code when `srb` fails by Morriar · Pull Request #3355 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Return a proper error code when srb fails #3355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2020

Conversation

Morriar
Copy link
Collaborator
@Morriar Morriar commented Aug 11, 2020

Motivation

In its current state, srb will return 0 even when the command is not found (or sorbet/ does not exists):

$ srb
No sorbet/ directory found. Maybe you want to run 'srb init'?
$ echo $?
0

$ srb foo
Unknown subcommand `foo`
$ echo $?
0

This behaviour is not consistent with other commonly used tools that generally return 1 or any other value different than 0 when such a case arise:

$ git status
fatal: not a git repository (or any of the parent directories): .git
$ echo $?
128

$ git foo
git: 'foo' is not a git command. See 'git --help'.
$ echo $?
1

Because of this, when using srb through a script it makes it harder to differentiate between 0 returned because no type checking errors were found or because you mistyped srb typcheck.

This pull-request make srb return 1 if the command is not found or the sorbet/ directory does not exist:

$ srb
No sorbet/ directory found. Maybe you want to run 'srb init'?
$ echo $?
1

$ srb foo
Unknown subcommand `foo`
$ echo $?
1

Test plan

See included automated tests.

Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar requested a review from a team as a code owner August 11, 2020 15:00
@Morriar Morriar requested review from jez and removed request for a team August 11, 2020 15:00
@jez jez merged commit 09ad24e into sorbet:master Aug 11, 2020
@Morriar Morriar deleted the at-fix-srb-return-code branch August 11, 2020 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0