Skip to content

Commit 7db323e

Browse files
committed
fixup! process: fix default env for process.execve
1 parent 2c87835 commit 7db323e

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

lib/internal/process/per_thread.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -301,22 +301,20 @@ function wrapProcessMethods(binding) {
301301
}
302302

303303
const envArray = [];
304-
if (env !== undefined) {
305-
validateObject(env, 'env');
306-
307-
for (const { 0: key, 1: value } of ObjectEntries(env)) {
308-
if (
309-
typeof key !== 'string' ||
310-
typeof value !== 'string' ||
311-
StringPrototypeIncludes(key, '\u0000') ||
312-
StringPrototypeIncludes(value, '\u0000')
313-
) {
314-
throw new ERR_INVALID_ARG_VALUE(
315-
'env', env, 'must be an object with string keys and values without null bytes',
316-
);
317-
} else {
318-
ArrayPrototypePush(envArray, `${key}=${value}`);
319-
}
304+
validateObject(env, 'env');
305+
306+
for (const { 0: key, 1: value } of ObjectEntries(env)) {
307+
if (
308+
typeof key !== 'string' ||
309+
typeof value !== 'string' ||
310+
StringPrototypeIncludes(key, '\u0000') ||
311+
StringPrototypeIncludes(value, '\u0000')
312+
) {
313+
throw new ERR_INVALID_ARG_VALUE(
314+
'env', env, 'must be an object with string keys and values without null bytes',
315+
);
316+
} else {
317+
ArrayPrototypePush(envArray, `${key}=${value}`);
320318
}
321319
}
322320

0 commit comments

Comments
 (0)