Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit81a3055

Browse files
richardlauaduh95
authored andcommitted
process: fix defaultenv forprocess.execve
The `env` parameter for `process.execve` is documented to defaultto `process.env`.PR-URL:#60029Refs:nodejs/build#4156Reviewed-By: Colin Ihrig <cjihrig@gmail.com>Reviewed-By: Michaël Zasso <targos@protonmail.com>Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent4206406 commit81a3055

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

‎lib/internal/process/per_thread.js‎

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function wrapProcessMethods(binding) {
283283
returntrue;
284284
}
285285

286-
functionexecve(execPath,args=[],env){
286+
functionexecve(execPath,args=[],env=process.env){
287287
emitExperimentalWarning('process.execve');
288288

289289
const{ isMainThread}=require('internal/worker');
@@ -305,22 +305,20 @@ function wrapProcessMethods(binding) {
305305
}
306306

307307
constenvArray=[];
308-
if(env!==undefined){
309-
validateObject(env,'env');
310-
311-
for(const{0:key,1:value}ofObjectEntries(env)){
312-
if(
313-
typeofkey!=='string'||
314-
typeofvalue!=='string'||
315-
StringPrototypeIncludes(key,'\u0000')||
316-
StringPrototypeIncludes(value,'\u0000')
317-
){
318-
thrownewERR_INVALID_ARG_VALUE(
319-
'env',env,'must be an object with string keys and values without null bytes',
320-
);
321-
}else{
322-
ArrayPrototypePush(envArray,`${key}=${value}`);
323-
}
308+
validateObject(env,'env');
309+
310+
for(const{0:key,1:value}ofObjectEntries(env)){
311+
if(
312+
typeofkey!=='string'||
313+
typeofvalue!=='string'||
314+
StringPrototypeIncludes(key,'\u0000')||
315+
StringPrototypeIncludes(value,'\u0000')
316+
){
317+
thrownewERR_INVALID_ARG_VALUE(
318+
'env',env,'must be an object with string keys and values without null bytes',
319+
);
320+
}else{
321+
ArrayPrototypePush(envArray,`${key}=${value}`);
324322
}
325323
}
326324

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp