@@ -279,7 +279,7 @@ function wrapProcessMethods(binding) {
279279 return true ;
280280 }
281281
282- function execve ( execPath , args = [ ] , env ) {
282+ function execve ( execPath , args = [ ] , env = process . env ) {
283283 emitExperimentalWarning ( 'process.execve' ) ;
284284
285285 const { isMainThread } = require ( 'internal/worker' ) ;
@@ -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