Skip to content

Conversation

@christopherfujino
Copy link
Contributor

@christopherfujino christopherfujino commented Apr 27, 2020

Description

Previously the attemptReset method (of the flutter upgrade flow) was invoking git with throwOnError while also checking if the exit code was non-zero. Thus we were never actually catching the errors. This wraps the process call in a try, catching ProcessExceptions and throwing tool exits on them.

Related Issues

Based on this comment, related to #55576

Tests

Added a new unit test to verify this behavior.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read [Handling breaking changes].

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.
    • I wrote a design doc: https://flutter.dev/go/template Replace this with a link to your design doc's short link
    • I got input from the developer relations team, specifically from: Replace with the names of who gave advice
    • I wrote a migration guide: Replace with a link to your migration guide

@fluttergithubbot fluttergithubbot added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 27, 2020
);
if (result.exitCode != 0) {
throwToolExit(null, exitCode: result.exitCode);
Future<void> attemptReset(String newRevision) async {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this first arg wasn't used


@override
Future<bool> attemptReset(FlutterVersion flutterVersion, String newRevision) async => alreadyUpToDate;
Future<void> attemptReset(String newRevision) async {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the return value was a mistake that should have been cleaned up in my previous PR.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…est.dart

Co-Authored-By: Jonah Williams <jonahwilliams@google.com>
@fluttergithubbot fluttergithubbot merged commit 069dc9c into flutter:master Apr 27, 2020
@christopherfujino christopherfujino deleted the catch-process-exception branch April 27, 2020 22:30
pcsosinski pushed a commit to pcsosinski/flutter that referenced this pull request Apr 28, 2020
pcsosinski pushed a commit that referenced this pull request Apr 28, 2020
* [flutter_tools] fix type error in symbolize (#55212)

* [flutter_tools] check first for stable tag, then dev tag (#55342)

* [flutter_tools] enable `flutter upgrade` to support force pushed branches (#55594)

* [flutter_tools] catch ProcessException and throw ToolExit during upgrade (#55759)

* Update engine version to 376ad6a64b08aa26005e3f82aed26de2e290b572

Co-authored-by: Jonah Williams <campfish91@gmail.com>
Co-authored-by: Christopher Fujino <fujino@google.com>
Co-authored-by: Christopher Fujino <christopherfujino@gmail.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants