[flutter_tools] handle windows holding file lock in web build directory#69115
Conversation
|
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( |
There was a problem hiding this comment.
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.');
}There was a problem hiding this comment.
This could definitely work, I was leaning towards the "quick fix" angle :)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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

Description
Fixes #69109