summaryrefslogtreecommitdiff
path: root/tools/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/util.js')
-rw-r--r--tools/util.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/util.js b/tools/util.js
index 11c07326f..20a2f210b 100644
--- a/tools/util.js
+++ b/tools/util.js
@@ -1,5 +1,4 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-import { deferred } from "../test_util/std/async/deferred.ts";
import {
dirname,
fromFileUrl,
@@ -182,10 +181,10 @@ const downloadUrl =
export async function downloadPrebuilt(toolName) {
// Ensure only one download per tool happens at a time
if (DOWNLOAD_TASKS[toolName]) {
- return await DOWNLOAD_TASKS[toolName];
+ return await DOWNLOAD_TASKS[toolName].promise;
}
- const downloadPromise = DOWNLOAD_TASKS[toolName] = deferred();
+ const downloadDeferred = DOWNLOAD_TASKS[toolName] = Promise.withResolvers();
const spinner = wait({
text: "Downloading prebuilt tool: " + toolName,
interval: 1000,
@@ -230,12 +229,12 @@ export async function downloadPrebuilt(toolName) {
await Deno.rename(tempFile, toolPath);
} catch (e) {
spinner.fail();
- downloadPromise.reject(e);
+ downloadDeferred.reject(e);
throw e;
}
spinner.succeed();
- downloadPromise.resolve(null);
+ downloadDeferred.resolve(null);
}
export async function verifyVersion(toolName, toolPath) {