-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
dart format --set-exit-if-changed not really setting the status code #44582
Comments
dart_style should be setting the exit code correctly. I have integration tests in the package to verify. It sets the exit code here using the |
From talking to @devoncarew, it seems likely that this has to do with the integration into Dart CLI, so assigning it back. |
Yeah, we don't use |
This has been fixed in |
Patch to roll it into the SDK is out for review: https://dart-review.googlesource.com/c/sdk/+/187740 |
This was merged in 3f5384b - will there be a 2.12.x patch release with this? |
This is in the SDK now, so bouncing to @bkonyi. |
The `dartfmt` command has been replaced with `dart format`. We currently can't quite replace `dartfmt` with `dart format` because the fix for dart-lang/sdk#44582 hasn't reached the Flutter beta channel yet, so we can't rely on its exit code. Additionally, unlike `dartfmt --dry-run`, `dart format --output=none` prints status to stdout even if nothing's changed, so we can no longer rely on the output being empty either. Luckily, `flutter format` does return a proper exit code, so use that.
The `dartfmt` command has been replaced with `dart format`. We currently can't quite replace `dartfmt` with `dart format` because the fix for dart-lang/sdk#44582 hasn't reached the Flutter beta channel yet, so we can't rely on its exit code. Additionally, unlike `dartfmt --dry-run`, `dart format --output=none` prints status to stdout even if nothing's changed, so we can no longer rely on the output being empty either. Luckily, `flutter format` does return a proper exit code, so use that.
Checking in flutter 2.5.1 |
I can't repro what you're seeing with the latest Dart SDK:
I'm not 100% certain that this fix is in Flutter 2.5.1, but I would be surprised if it wasn't. Is it possible that you have an older Dart SDK on your PATH somehow? |
Maybe) |
I'm not 100% sure the
dart
cli tool, but I've seen other issues with it reported here, so I guess it it.When I use
dart format --output none --set-exit-if-changed
the exit status is not really changed (it used 0):The text was updated successfully, but these errors were encountered: