fix(windows): handle undefined environment variables in runCommandWithTimeout

This commit is contained in:
Burak Sormageç 2026-01-30 16:17:36 +00:00
parent 57d98eb1d7
commit 950377f041

View File

@ -73,7 +73,11 @@ export async function runCommandWithTimeout(
return false;
})();
const resolvedEnv = env ? { ...process.env, ...env } : { ...process.env };
const resolvedEnv = Object.fromEntries(
Object.entries({ ...process.env, ...(env ?? {}) })
.filter(([, value]) => value !== undefined)
.map(([key, value]) => [key, String(value)]),
);
if (shouldSuppressNpmFund) {
if (resolvedEnv.NPM_CONFIG_FUND == null) resolvedEnv.NPM_CONFIG_FUND = "false";
if (resolvedEnv.npm_config_fund == null) resolvedEnv.npm_config_fund = "false";