| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 77ec400 commit cff4a76
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -279,7 +279,7 @@ function wrapProcessMethods(binding) { | |||
| 279 | 279 | return true; | |
| 280 | 280 | } | |
| 281 | 281 | ||
| 282 | - function execve(execPath, args = [], env) { | ||
| 282 | + function execve(execPath, args = [], env = process.env) { | ||
| 283 | 283 | emitExperimentalWarning('process.execve'); | |
| 284 | 284 | ||
| 285 | 285 | const { isMainThread } = require('internal/worker'); | |
@@ -301,22 +301,20 @@ function wrapProcessMethods(binding) { | |||
| 301 | 301 | } | |
| 302 | 302 | ||
| 303 | 303 | 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}`); | ||
| 320 | 318 | } | |
| 321 | 319 | } | |
| 322 | 320 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments