Index: utils/pub/io.dart |
diff --git a/utils/pub/io.dart b/utils/pub/io.dart |
index 0309b90d9af0cc55fd32cb1a2c42f721b7135e30..0611b35df47addd89380fb0b3395fc675598352c 100644 |
--- a/utils/pub/io.dart |
+++ b/utils/pub/io.dart |
@@ -749,10 +749,10 @@ Future timeout(Future input, int milliseconds, String description) { |
/// will be deleted. |
Future withTempDir(Future fn(String path)) { |
var tempDir; |
- return asyncWhenComplete(createTempDir().then((dir) { |
+ return createTempDir().then((dir) { |
tempDir = dir; |
return fn(tempDir.path); |
- }), () { |
+ }).whenComplete(() { |
log.fine('Cleaning up temp directory ${tempDir.path}.'); |
return deleteDir(tempDir); |
}); |