Skip to content

Commit d317dd2

Browse files
committed
fix(smol): resolve python and ninja paths on Windows
With shell: false, commands aren't resolved via PATH. Use whichBinSync to get full paths to python.exe and ninja.exe on Windows before exec().
1 parent 4efbd96 commit d317dd2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/node-smol-builder/scripts/build.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,8 @@ async function main() {
14251425
}
14261426

14271427
// Windows uses configure.py directly, Unix uses ./configure wrapper script.
1428-
const configureCommand = WIN32 ? 'python' : './configure'
1428+
// Use whichBinSync to resolve full path to python.exe since we use shell: false.
1429+
const configureCommand = WIN32 ? whichBinSync('python') : './configure'
14291430
const configureArgs = WIN32 ? ['configure.py', ...configureFlags] : configureFlags
14301431

14311432
// DEBUG: Verify environment is being passed to subprocess.
@@ -1507,7 +1508,9 @@ async function main() {
15071508
logger.log('::group::Compiling Node.js with Ninja (this will take a while...)')
15081509

15091510
try {
1510-
await exec('ninja', ['-C', 'out/Release', `-j${CPU_COUNT}`], {
1511+
// Resolve full path to ninja on Windows since we use shell: false.
1512+
const ninjaCommand = WIN32 ? whichBinSync('ninja') : 'ninja'
1513+
await exec(ninjaCommand, ['-C', 'out/Release', `-j${CPU_COUNT}`], {
15111514
cwd: NODE_DIR,
15121515
env: process.env,
15131516
shell: false,

0 commit comments

Comments
 (0)