Skip to content

Commit c7ffa98

Browse files
Fix invocation of node wrapper scripts on windows
1 parent 7d5e69f commit c7ffa98

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

server/src/utils.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ export let findBscBinary = (
6565
return findBinary(binaryDirPath, c.bscBinName);
6666
};
6767

68+
export let executeNodeWrapperSync = (
69+
buildPath: p.DocumentUri,
70+
args: string[]
71+
) => {
72+
if (process.platform === "win32") {
73+
return childProcess.execSync(`"${buildPath}".cmd ${args.join(" ")}`);
74+
} else {
75+
return childProcess.execFileSync(buildPath, args);
76+
}
77+
};
78+
6879
type execResult =
6980
| {
7081
kind: "success";
@@ -89,7 +100,7 @@ export let formatCode = (
89100
// It will try to use the user formatting binary.
90101
// If not, use the one we ship with the analysis binary in the extension itself.
91102
if (bscPath != null) {
92-
let result = childProcess.execFileSync(bscPath, [
103+
let result = executeNodeWrapperSync(bscPath, [
93104
"-color",
94105
"never",
95106
"-format",

0 commit comments

Comments
 (0)