Skip to content

Commit 9ac523d

Browse files
committed
compute realpath ofr binaries
1 parent 636c929 commit 9ac523d

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

cli/common/bins.js

+31-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// @ts-check
22

3+
import * as fs from "node:fs";
4+
35
/**
46
* @typedef {{
57
* binDir: string,
@@ -27,15 +29,33 @@ try {
2729
throw new Error(`Platform ${target} is not supported!`);
2830
}
2931

32+
let binPaths = mod.binPaths;
33+
try {
34+
binPaths = {
35+
bsb_helper_exe: fs.realpathSync(binPaths.bsb_helper_exe),
36+
bsc_exe: fs.realpathSync(binPaths.bsc_exe),
37+
ninja_exe: fs.realpathSync(binPaths.ninja_exe),
38+
rescript_editor_analysis_exe: fs.realpathSync(
39+
binPaths.rescript_editor_analysis_exe,
40+
),
41+
rescript_tools_exe: fs.realpathSync(binPaths.rescript_tools_exe),
42+
rescript_exe: fs.realpathSync(binPaths.rescript_exe),
43+
rewatch_exe: fs.realpathSync(binPaths.rewatch_exe),
44+
};
45+
} catch (err) {
46+
console.warn(
47+
"Cannot populate the realpath of a binary, some tests may fails",
48+
err,
49+
);
50+
}
51+
52+
export const platformDir = mod.binDir;
3053
export const {
31-
binDir: platformDir,
32-
binPaths: {
33-
bsb_helper_exe,
34-
bsc_exe,
35-
ninja_exe,
36-
rescript_editor_analysis_exe,
37-
rescript_tools_exe,
38-
rescript_exe,
39-
rewatch_exe,
40-
},
41-
} = mod;
54+
bsb_helper_exe,
55+
bsc_exe,
56+
ninja_exe,
57+
rescript_editor_analysis_exe,
58+
rescript_tools_exe,
59+
rescript_exe,
60+
rewatch_exe,
61+
} = binPaths;

0 commit comments

Comments
 (0)