(script, args, env)
| 324 | } |
| 325 | |
| 326 | function runNodeScript(script, args, env) { |
| 327 | const result = spawnSync( |
| 328 | process.execPath, |
| 329 | [path.join(root, script), ...args], |
| 330 | { |
| 331 | cwd: root, |
| 332 | encoding: "utf8", |
| 333 | env: { ...process.env, ...env }, |
| 334 | stdio: "inherit", |
| 335 | timeout: 300_000, |
| 336 | }, |
| 337 | ); |
| 338 | if (result.status !== 0) { |
| 339 | throw new Error(`${script} failed with ${result.status}`); |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | function httpJson(pathname) { |
| 344 | return new Promise((resolve, reject) => { |