| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 39dbc10 commit 4022617
23 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | const { spawnSync } = require('child_process'); | |
| 2 | - const env = Object.assign({}, process.env, { NODE_V8_COVERAGE: '' }); | ||
| 2 | + const env = { ...process.env, NODE_V8_COVERAGE: '' }; | ||
| 3 | 3 | spawnSync(process.execPath, [require.resolve('./subprocess')], { | |
| 4 | 4 | env: env | |
| 5 | 5 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | const { spawnSync } = require('child_process'); | |
| 2 | - const env = Object.assign({}, process.env); | ||
| 2 | + const env = { ...process.env }; | ||
| 3 | 3 | delete env.NODE_V8_COVERAGE | |
| 4 | 4 | spawnSync(process.execPath, [require.resolve('./subprocess')], { | |
| 5 | 5 | env: env | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,12 +26,13 @@ const os = require('os'); | |||
| 26 | 26 | ||
| 27 | 27 | const spawn = require('child_process').spawn; | |
| 28 | 28 | ||
| 29 | - const env = Object.assign({}, process.env, { | ||
| 29 | + const env = { | ||
| 30 | + ...process.env, | ||
| 30 | 31 | 'HELLO': 'WORLD', | |
| 31 | 32 | 'UNDEFINED': undefined, | |
| 32 | 33 | 'NULL': null, | |
| 33 | 34 | 'EMPTY': '' | |
| 34 | - }); | ||
| 35 | + }; | ||
| 35 | 36 | Object.setPrototypeOf(env, { | |
| 36 | 37 | 'FOO': 'BAR' | |
| 37 | 38 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,7 +45,7 @@ if (!common.isWindows) { | |||
| 45 | 45 | child = exec('/usr/bin/env', { env: { 'HELLO': 'WORLD' } }, after); | |
| 46 | 46 | } else { | |
| 47 | 47 | child = exec('set', | |
| 48 | - { env: Object.assign({}, process.env, { 'HELLO': 'WORLD' }) }, | ||
| 48 | + { env: { ...process.env, 'HELLO': 'WORLD' } }, | ||
| 49 | 49 | after); | |
| 50 | 50 | } | |
| 51 | 51 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ const expected = common.isWindows ? '%foo%' : '$foo'; | |||
| 8 | 8 | if (process.argv[2] === undefined) { | |
| 9 | 9 | const child = cp.fork(__filename, [expected], { | |
| 10 | 10 | shell: true, | |
| 11 | - env: Object.assign({}, process.env, { foo: 'bar' }) | ||
| 11 | + env: { ...process.env, foo: 'bar' } | ||
| 12 | 12 | }); | |
| 13 | 13 | ||
| 14 | 14 | child.on('exit', common.mustCall((code, signal) => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,7 +50,7 @@ command.on('close', common.mustCall((code, signal) => { | |||
| 50 | 50 | ||
| 51 | 51 | // Verify that the environment is properly inherited | |
| 52 | 52 | const env = cp.spawn(`"${process.execPath}" -pe process.env.BAZ`, { | |
| 53 | - env: Object.assign({}, process.env, { BAZ: 'buzz' }), | ||
| 53 | + env: { ...process.env, BAZ: 'buzz' }, | ||
| 54 | 54 | encoding: 'utf8', | |
| 55 | 55 | shell: true | |
| 56 | 56 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,7 +37,7 @@ assert.strictEqual(command.stdout.toString().trim(), 'bar'); | |||
| 37 | 37 | ||
| 38 | 38 | // Verify that the environment is properly inherited | |
| 39 | 39 | const env = cp.spawnSync(`"${process.execPath}" -pe process.env.BAZ`, { | |
| 40 | - env: Object.assign({}, process.env, { BAZ: 'buzz' }), | ||
| 40 | + env: { ...process.env, BAZ: 'buzz' }, | ||
| 41 | 41 | shell: true | |
| 42 | 42 | }); | |
| 43 | 43 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ disallow('--v8-options'); | |||
| 28 | 28 | disallow('--'); | |
| 29 | 29 | ||
| 30 | 30 | function disallow(opt) { | |
| 31 | - const env = Object.assign({}, process.env, { NODE_OPTIONS: opt }); | ||
| 31 | + const env = { ...process.env, NODE_OPTIONS: opt }; | ||
| 32 | 32 | exec(process.execPath, { cwd: tmpdir.path, env }, common.mustCall((err) => { | |
| 33 | 33 | const message = err.message.split(/\r?\n/)[1]; | |
| 34 | 34 | const expect = `${process.execPath}: ${opt} is not allowed in NODE_OPTIONS`; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,7 +71,7 @@ testHelper( | |||
| 71 | 71 | [], | |
| 72 | 72 | FIPS_DISABLED, | |
| 73 | 73 | 'require("crypto").getFips()', | |
| 74 | - Object.assign({}, process.env, { 'OPENSSL_CONF': '' })); | ||
| 74 | + { ...process.env, 'OPENSSL_CONF': '' }); | ||
| 75 | 75 | ||
| 76 | 76 | // --enable-fips should turn FIPS mode on | |
| 77 | 77 | testHelper( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,7 @@ if (process.argv[2] === 'child') { | |||
| 7 | 7 | process.emitWarning('foo'); | |
| 8 | 8 | } else { | |
| 9 | 9 | function test(newEnv) { | |
| 10 | - const env = Object.assign({}, process.env, newEnv); | ||
| 10 | + const env = { ...process.env, ...newEnv }; | ||
| 11 | 11 | const cmd = `"${process.execPath}" "${__filename}" child`; | |
| 12 | 12 | ||
| 13 | 13 | cp.exec(cmd, { env }, common.mustCall((err, stdout, stderr) => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments