From 55e962b6886ad5b3d39ecb7b146f646f3081b659 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Thu, 3 Jun 2021 22:32:18 +0800 Subject: [PATCH] feat(cli): support URL overload for `Deno.chdir` (#10793) --- cli/dts/lib.deno.ns.d.ts | 2 +- runtime/js/30_fs.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index 3db07ba657..2032757bb0 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -248,7 +248,7 @@ declare namespace Deno { * * Requires --allow-read. */ - export function chdir(directory: string): void; + export function chdir(directory: string | URL): void; /** * Return a string representing the current working directory. diff --git a/runtime/js/30_fs.js b/runtime/js/30_fs.js index 84e1c68195..913158a34b 100644 --- a/runtime/js/30_fs.js +++ b/runtime/js/30_fs.js @@ -58,7 +58,7 @@ } function chdir(directory) { - core.opSync("op_chdir", directory); + core.opSync("op_chdir", pathFromURL(directory)); } function makeTempDirSync(options = {}) {