Skip to content

Commit

Permalink
[firehose] Set exit code and return instead of calling exit(X) (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo authored Feb 10, 2025
1 parent 5b0d815 commit fe4979b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions pkgs/firehose/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.0.0-wip

## 0.10.2

- Don't check licenses of generated files in PR health workflow.
Expand Down
11 changes: 7 additions & 4 deletions pkgs/firehose/bin/firehose.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void main(List<String> arguments) async {

if (argResults[helpFlag] as bool) {
_usage(argParser);
exit(0);
return;
}

final validate = argResults[validateFlag] as bool;
Expand All @@ -34,15 +34,17 @@ void main(List<String> arguments) async {
if (!validate && !publish) {
_usage(argParser,
error: 'Error: one of --validate or --publish must be specified.');
exit(1);
exitCode = 1;
return;
}

final github = GithubApi();
if (publish && !github.inGithubContext) {
_usage(argParser,
error: 'Error: --publish can only be executed from within a GitHub '
'action.');
exit(1);
exitCode = 1;
return;
}

final firehose = Firehose(Directory.current, useFlutter, ignoredPackages);
Expand All @@ -54,7 +56,8 @@ void main(List<String> arguments) async {
}
} on ArgParserException catch (e) {
_usage(argParser, error: e.message);
exit(1);
exitCode = 1;
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkgs/firehose/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: firehose
description: A tool to automate publishing of Pub packages from GitHub actions.
version: 0.10.2
version: 1.0.0-wip
repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose

environment:
Expand Down

0 comments on commit fe4979b

Please sign in to comment.