1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(windows): Deno.Command - align binary resolution with linux and mac (#25429)

This commit is contained in:
David Sherret 2024-09-04 17:03:09 +02:00 committed by GitHub
parent c6d1b0a1cc
commit 5400f1af6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -975,3 +975,35 @@ Deno.test(
);
},
);
Deno.test(
{ permissions: { write: true, run: true, read: true } },
async function commandWithCwdOrPath() {
const cwd = Deno.makeTempDirSync({ prefix: "deno_command_test" });
try {
const suffix = Deno.build.os === "windows" ? ".exe" : "";
Deno.mkdirSync(`${cwd}/subdir`);
Deno.copyFileSync(Deno.execPath(), `${cwd}/subdir/my_binary${suffix}`);
// cwd
{
const output = await new Deno.Command(`./my_binary${suffix}`, {
cwd: `${cwd}/subdir`,
args: ["-v"],
}).output();
assertEquals(output.success, true);
}
// path
{
const output = await new Deno.Command(`my_binary${suffix}`, {
env: {
PATH: `${cwd}/subdir`,
},
args: ["-v"],
}).output();
assertEquals(output.success, true);
}
} finally {
Deno.removeSync(cwd, { recursive: true });
}
},
);