Skip to content
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

[firehose] Set exit code and return instead of calling exit(X) #341

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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