Skip to content

Commit 4efbd96

Browse files
committed
refactor(build): simplify shell: false logic
Remove unnecessary platform checks - shell: false is explicit and works on all platforms. No need to conditionally set it only on Windows.
1 parent df1b763 commit 4efbd96

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,12 +1447,14 @@ async function main() {
14471447
logger.log(`::group::Running ${WIN32 ? 'python configure.py' : './configure'}`)
14481448

14491449
// On Windows, explicitly pass environment to subprocess.
1450-
// IMPORTANT: When passing custom env, we must disable shell wrapping (shell: false)
1451-
// because cmd.exe doesn't properly propagate environment variables to subprocesses.
1452-
const execOptions = { cwd: NODE_DIR }
1450+
// IMPORTANT: Must use shell: false because cmd.exe doesn't properly
1451+
// propagate environment variables to subprocesses.
1452+
const execOptions = {
1453+
cwd: NODE_DIR,
1454+
env: process.env,
1455+
shell: false,
1456+
}
14531457
if (WIN32) {
1454-
execOptions.env = process.env
1455-
execOptions.shell = false // Critical: disable cmd.exe wrapper
14561458
logger.log(`DEBUG: Passing env with ${Object.keys(process.env).length} variables (shell: false)`)
14571459
}
14581460

@@ -1505,12 +1507,11 @@ async function main() {
15051507
logger.log('::group::Compiling Node.js with Ninja (this will take a while...)')
15061508

15071509
try {
1508-
// On Windows, disable shell wrapper when passing env (same as configure.py).
1509-
const ninjaOptions = { cwd: NODE_DIR, env: process.env }
1510-
if (WIN32) {
1511-
ninjaOptions.shell = false
1512-
}
1513-
await exec('ninja', ['-C', 'out/Release', `-j${CPU_COUNT}`], ninjaOptions)
1510+
await exec('ninja', ['-C', 'out/Release', `-j${CPU_COUNT}`], {
1511+
cwd: NODE_DIR,
1512+
env: process.env,
1513+
shell: false,
1514+
})
15141515
logger.log('::endgroup::')
15151516
} catch (e) {
15161517
logger.log('::endgroup::')

0 commit comments

Comments
 (0)