Skip to content

Commit

Permalink
fix: providing paths with backslashes on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Sep 9, 2024
1 parent e486644 commit 83956c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<unknown>) {
return new Promise<void>((resolve, reject) => {
promise.then(() => reject(new Error("Promise was resolved")));
Expand Down
Empty file removed src/path.ts
Empty file.
2 changes: 1 addition & 1 deletion src/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ interface UnresolvedCommand {
}

async function resolveCommand(unresolvedCommand: UnresolvedCommand, context: Context): Promise<ResolvedCommand> {
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);
Expand Down

0 comments on commit 83956c6

Please sign in to comment.