From 83956c6d3f977560568b731a38902e22cd33ca7f Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 9 Sep 2024 18:44:11 -0400 Subject: [PATCH] fix: providing paths with backslashes on windows --- mod.test.ts | 5 +++++ src/path.ts | 0 src/shell.ts | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) delete mode 100644 src/path.ts diff --git a/mod.test.ts b/mod.test.ts index 4ccc1e2..d63d6f1 100644 --- a/mod.test.ts +++ b/mod.test.ts @@ -2271,6 +2271,11 @@ Deno.test("expect error undefined", async () => { }); }); +Deno.test("resolve command by path", async () => { + const version = await $`${Deno.execPath()} --version`.text(); + assert(typeof version === "string"); +}); + function ensurePromiseNotResolved(promise: Promise) { return new Promise((resolve, reject) => { promise.then(() => reject(new Error("Promise was resolved"))); diff --git a/src/path.ts b/src/path.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/shell.ts b/src/shell.ts index 5f7ecaa..114c43f 100644 --- a/src/shell.ts +++ b/src/shell.ts @@ -1174,7 +1174,7 @@ interface UnresolvedCommand { } async function resolveCommand(unresolvedCommand: UnresolvedCommand, context: Context): Promise { - if (unresolvedCommand.name.includes("/")) { + if (unresolvedCommand.name.includes("/") || Deno.build.os === "windows" && unresolvedCommand.name.includes("\\")) { const commandPath = path.isAbsolute(unresolvedCommand.name) ? unresolvedCommand.name : path.resolve(unresolvedCommand.baseDir, unresolvedCommand.name);