Repository navigation
[flutter_tools] Stop deletion progress status during flutter clean - #192996
Merged
Merged
Conversation
Ensure deletionStatus.stop() is always called in a finally block around file.deleteSync(recursive: true) in CleanCommand._deleteFile. Previously, deletionStatus.stop() was only called inside the FileSystemException catch block, leaving the first progress spinner unstopped on successful deletions, suppressing subsequent progress statuses, and omitting the trailing newline on exit. Fixes flutter#192531
Contributor
There was a problem hiding this comment.
Code Review
This pull request ensures that the directory deletion progress status is stopped during the clean command execution, even if a FileSystemException is thrown, and adds a test to verify this behavior. The feedback suggests simplifying the nested try-finally block by placing the stop call sequentially in both the try and catch blocks to improve code readability.
srawlins
approved these changes
Sep 18, 2026
This was referenced Sep 18, 2026
Contributor
|
Failed to create CP due to merge conflicts. |
Contributor
|
Failed to create CP due to merge conflicts. |
This was referenced Sep 21, 2026
2 of 5 tasks
auto-submit Bot
pushed a commit
that referenced
this pull request
Sep 28, 2026
…lean (#193110) This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request) Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: #192531 ### Impact Description: Running `flutter clean` leaves the first `Deleting ...` terminal spinner/status active after `build/` is deleted because `deletionStatus.stop()` is only called in the `FileSystemException` catch block instead of a `finally` block. Because `StdoutLogger.startProgress` ignores new progress statuses while an existing status is active and only emits a trailing newline when stopped, subsequent deletion statuses (`.dart_tool/`, `ephemeral/`, etc.) are suppressed and the terminal cursor is left mid-line on exit, making `flutter clean` appear to freeze or break off mid-execution. *(Cherry-pick note: Rebased/merged onto `flutter-3.49-candidate.0`. Because `flutter-3.49-candidate.0` already includes the modular dependency injection migration for `CleanCommand` (#190742), both `packages/flutter_tools/lib/src/commands/clean.dart` and `packages/flutter_tools/test/commands.shard/hermetic/clean_test.dart` match upstream [#192996](#192996) (`f960c3ae208`) byte-for-byte.)* ### Changelog Description: [flutter/192531] When running `flutter clean` on all platforms, the deletion progress spinner no longer hangs after deleting the first directory and all cleaned directories are properly reported. ### Workaround: None for the broken terminal progress output, though `flutter clean` still deletes the directories in the background. ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: 1. Create or open a Flutter project and build it so `build/` and `.dart_tool/` exist. 2. Run `flutter clean` in an interactive terminal. 3. Verify that each `Deleting ...` progress status completes with an elapsed time and a trailing newline is emitted when the command finishes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ensure
deletionStatus.stop()is always called in afinallyblock aroundfile.deleteSync(recursive: true)inCleanCommand._deleteFile.Previously,
deletionStatus.stop()was only called inside theon FileSystemException catchblock, leavingStdoutLogger._statusactive on successful file deletions. BecauseStdoutLogger.startProgressignores new statuses when_status != nulland only emits the trailing newline instop()/cancel(), the firstDeleting ...progress status remained unstopped, suppressing all subsequent deletion progress statuses and omitting the trailing newline on exit.Adds a regression test in
packages/flutter_tools/test/commands.shard/hermetic/clean_test.dartverifying thatflutter cleanstops each deletion progress status and logs every deleted directory.Fixes #192531
Pre-launch Checklist
///).