Skip to content

Commit 9dfcf0f

Browse files
Avoid error on Windows in double-link-sh.js
1 parent 7aca8f6 commit 9dfcf0f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

script/double-link-sh.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import fs from "node:fs";
88
import path from "node:path";
9+
import { exit } from "node:process";
910

1011
import which from "which";
1112

@@ -15,7 +16,11 @@ if (!fs.existsSync(temp)) {
1516
fs.mkdirSync(temp, { recursive: true });
1617
}
1718

18-
const shell = which.sync("sh");
19+
const shell = which.sync("sh", { nothrow: true });
20+
if (shell === null) {
21+
exit(0);
22+
}
23+
1924
const linkToShell = path.resolve(temp, "link-to-shell");
2025
const linkToLink = path.resolve(temp, "link-to-link");
2126
if (!fs.existsSync(linkToLink)) {

0 commit comments

Comments
 (0)