Skip to content

Conversation

@jonahwilliams
Copy link
Contributor

Description

Fixes #69109

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Oct 27, 2020
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

ErrorHandlingFileSystem.deleteIfExists(outputDirectory, recursive: true);
outputDirectory.createSync(recursive: true);
} on FileSystemException catch (err) {
globals.logger.printError(
Copy link
Contributor

@yjbanov yjbanov Oct 28, 2020

Choose a reason for hiding this comment

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

I think I'd rather crash than keep on trucking. The latter could lead to even harder to debug situations.

Since this function is async, can we print the issue and wait until the directory is unlocked? Pseudo-code:

bool deleted = false;
bool warningPrinted = false;

while (!deleted) {
  try {
    delete();
    deleted = true;
  } on FileSystemException {
    if (!warningPrinted) {
      globals.logger.printError('Directory $outputDirectory is locked by another program. Waiting for the directory to be unlocked.');
      warningPrinted = true;
    }
    await Future.delayed(Duration(milliseconds: 50));
  }
}

if (warningPrinted) {
  globals.logger.printInfo('Directory $outputDirectory was unlocked and deleted. Continuing.');
}

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 could definitely work, I was leaning towards the "quick fix" angle :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

though I think the problem with this is that we will probably delete most of the files successfully, so that leaves a partially invalid state

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually ... lets do a partial revert for now. this is causing crashes and I don't quite have the time I need for a long term solution

@jonahwilliams jonahwilliams requested a review from yjbanov October 30, 2020 16:00
Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

[tool_crash] FileSystemException: Deletion failed, OS Error: The process cannot access the file because it is being used by another process., errno = 32

2 participants