@@ -283,7 +283,7 @@ function wrapProcessMethods(binding) {
283283 return true ;
284284 }
285285
286- function execve ( execPath , args = [ ] , env ) {
286+ function execve ( 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 const envArray = [ ] ;
308- if ( env !== undefined ) {
309- validateObject ( env , 'env' ) ;
310-
311- for ( const { 0 : key , 1 : value } of ObjectEntries ( env ) ) {
312- if (
313- typeof key !== 'string' ||
314- typeof value !== 'string' ||
315- StringPrototypeIncludes ( key , '\u0000' ) ||
316- StringPrototypeIncludes ( value , '\u0000' )
317- ) {
318- throw new ERR_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 } of ObjectEntries ( env ) ) {
311+ if (
312+ typeof key !== 'string' ||
313+ typeof value !== 'string' ||
314+ StringPrototypeIncludes ( key , '\u0000' ) ||
315+ StringPrototypeIncludes ( value , '\u0000' )
316+ ) {
317+ throw new ERR_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