Protect the deletion of the local engine temp dir in case it is already deleted (#57345)

This commit is contained in:
Jim Graham 2020-05-18 02:37:03 -07:00 committed by GitHub
parent 07f9563dac
commit 5c78e723fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1001,8 +1001,11 @@ Directory _getLocalEngineRepo({
.createTempSync('flutter_tool_local_engine_repo.');
// Remove the local engine repo before the tool exits.
shutdownHooks.addShutdownHook(
() => localEngineRepo.deleteSync(recursive: true),
shutdownHooks.addShutdownHook(() {
if (localEngineRepo.existsSync()) {
localEngineRepo.deleteSync(recursive: true);
}
},
ShutdownStage.CLEANUP,
);