Skip to content

Commit 8352944

Browse files
committed
debug(build): add environment variable verification before configure.py
Adding comprehensive debug logging to diagnose why environment variables aren't being passed to configure.py subprocess even though env: process.env is specified in exec() options. Will show: - Values of critical VS variables in process.env before exec() - Number of variables being passed to subprocess - Help identify if the issue is with spawn/exec implementation
1 parent a224af3 commit 8352944

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,8 +1428,32 @@ async function main() {
14281428
const configureCommand = WIN32 ? 'python' : './configure'
14291429
const configureArgs = WIN32 ? ['configure.py', ...configureFlags] : configureFlags
14301430

1431+
// DEBUG: Verify environment is being passed to subprocess.
1432+
if (WIN32) {
1433+
logger.log('')
1434+
logger.log('DEBUG: Checking environment before exec():')
1435+
const criticalVars = ['VCINSTALLDIR', 'WindowsSDKVersion', 'INCLUDE', 'LIB']
1436+
for (const varName of criticalVars) {
1437+
const value = process.env[varName]
1438+
if (value) {
1439+
logger.log(` ${colors.green('✓')} ${varName} = ${value.substring(0, 60)}...`)
1440+
} else {
1441+
logger.log(` ${colors.red('✗')} ${varName} is NOT SET`)
1442+
}
1443+
}
1444+
logger.log('')
1445+
}
1446+
14311447
logger.log(`::group::Running ${WIN32 ? 'python configure.py' : './configure'}`)
1432-
await exec(configureCommand, configureArgs, { cwd: NODE_DIR, env: process.env })
1448+
1449+
// On Windows, explicitly pass environment to subprocess.
1450+
const execOptions = { cwd: NODE_DIR }
1451+
if (WIN32) {
1452+
execOptions.env = process.env
1453+
logger.log(`DEBUG: Passing env option with ${Object.keys(process.env).length} variables`)
1454+
}
1455+
1456+
await exec(configureCommand, configureArgs, execOptions)
14331457
logger.log('::endgroup::')
14341458
logger.log(`${colors.green('✓')} Configuration complete`)
14351459
logger.log('')

0 commit comments

Comments
 (0)