2024-09-16 19:08:02 -04:00
|
|
|
const binaryName = Deno.build.os === "windows" ? "binary.exe" : "binary";
|
2024-09-04 08:51:24 -04:00
|
|
|
const pathSep = Deno.build.os === "windows" ? "\\" : "/";
|
|
|
|
|
|
|
|
Deno.mkdirSync("subdir");
|
|
|
|
Deno.copyFileSync(binaryName, "subdir/" + binaryName);
|
|
|
|
|
|
|
|
try {
|
|
|
|
const commandResult = new Deno.Command(
|
2024-09-16 19:08:02 -04:00
|
|
|
"binary",
|
2024-09-04 08:51:24 -04:00
|
|
|
{
|
|
|
|
env: { "PATH": Deno.cwd() + pathSep + "subdir" },
|
|
|
|
stdout: "inherit",
|
|
|
|
stderr: "inherit",
|
|
|
|
},
|
|
|
|
).outputSync();
|
|
|
|
|
|
|
|
console.log(commandResult.code);
|
|
|
|
} catch (err) {
|
|
|
|
console.log(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
const child = Deno.run(
|
|
|
|
{
|
2024-09-16 19:08:02 -04:00
|
|
|
cmd: ["binary"],
|
2024-09-04 08:51:24 -04:00
|
|
|
env: { "PATH": Deno.cwd() + pathSep + "subdir" },
|
|
|
|
stdout: "inherit",
|
|
|
|
stderr: "inherit",
|
|
|
|
},
|
|
|
|
);
|
|
|
|
console.log((await child.status()).code);
|
|
|
|
} catch (err) {
|
|
|
|
console.log(err);
|
|
|
|
}
|