Skip to content

Commit 791eb2f

Browse files
committed
Add -runtime-path handling to bsc.js
1 parent e21a595 commit 791eb2f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cli/bsc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
import { execFileSync } from "node:child_process";
66

77
import { bsc_exe } from "./common/bins.js";
8+
import { runtimePath } from "./common/runtime.js";
89

910
const delegate_args = process.argv.slice(2);
11+
if (!delegate_args.includes("-runtime-path")) {
12+
delegate_args.push("-runtime-path", runtimePath);
13+
}
1014

1115
try {
1216
execFileSync(bsc_exe, delegate_args, { stdio: "inherit" });

cli/common/runtime.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @ts-check
2+
import { createRequire } from "node:module";
3+
import * as path from "node:path";
4+
5+
const require = createRequire(import.meta.url);
6+
7+
const runtimePackageJson = require.resolve("@rescript/runtime/package.json");
8+
9+
export const runtimePath = path.dirname(runtimePackageJson);

0 commit comments

Comments
 (0)