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

Appearance settings

Commit 26a7ec6

Browse filesBrowse files
Junliang Yanjasnell
authored andcommitted
test: fix losing original env vars issue
Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> PR-URL: #3190
1 parent 9136359 commit 26a7ec6
Copy full SHA for 26a7ec6

File tree

Expand file treeCollapse file tree

5 files changed

+10
-17
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+10
-17
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-child-process-spawnsync-env.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-spawnsync-env.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (process.argv[2] === 'child') {
88
} else {
99
var expected = 'bar';
1010
var child = cp.spawnSync(process.execPath, [__filename, 'child'], {
11-
env: {foo: expected}
11+
env: Object.assign(process.env, { foo: expected })
1212
});
1313

1414
assert.equal(child.stdout.toString().trim(), expected);
Collapse file

‎test/parallel/test-fs-readfile-error.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-readfile-error.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var callbacks = 0;
1616
function test(env, cb) {
1717
var filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js');
1818
var execPath = '"' + process.execPath + '" "' + filename + '"';
19-
var options = { env: env || {} };
19+
var options = { env: Object.assign(process.env, env) };
2020
exec(execPath, options, function(err, stdout, stderr) {
2121
assert(err);
2222
assert.equal(stdout, '');
Collapse file

‎test/sequential/test-net-GH-5504.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-net-GH-5504.js
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ function parent() {
5353
var serverExited = false;
5454
var clientExited = false;
5555
var serverListened = false;
56-
var opt = {
57-
env: {
58-
NODE_DEBUG: 'net',
59-
NODE_COMMON_PORT: process.env.NODE_COMMON_PORT,
60-
}
61-
};
6256

6357
process.on('exit', function() {
6458
assert(serverExited);
@@ -75,7 +69,11 @@ function parent() {
7569
});
7670
}, common.platformTimeout(2000)).unref();
7771

78-
var s = spawn(node, [__filename, 'server'], opt);
72+
var s = spawn(node, [__filename, 'server'], {
73+
env: Object.assign(process.env, {
74+
NODE_DEBUG: 'net'
75+
})
76+
});
7977
var c;
8078

8179
wrap(s.stderr, process.stderr, 'SERVER 2>');
Collapse file

‎test/sequential/test-stdin-script-child.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-stdin-script-child.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ var assert = require('assert');
44

55
var spawn = require('child_process').spawn;
66
var child = spawn(process.execPath, [], {
7-
env: {
7+
env: Object.assign(process.env, {
88
NODE_DEBUG: process.argv[2]
9-
}
9+
})
1010
});
1111
var wanted = child.pid + '\n';
1212
var found = '';
Collapse file

‎test/sequential/test-util-debug.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-util-debug.js
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ function test(environ, shouldWrite) {
2727

2828
var spawn = require('child_process').spawn;
2929
var child = spawn(process.execPath, [__filename, 'child'], {
30-
// Lttng requires the HOME env variable or it prints to stderr,
31-
// This is not really ideal, as it breaks this test, so the HOME
32-
// env variable is passed to the child to make the test pass.
33-
// this is fixed in the next version of lttng (2.7+), so we can
34-
// remove it at sometime in the future.
35-
env: { NODE_DEBUG: environ, HOME: process.env.HOME }
30+
env: Object.assign(process.env, { NODE_DEBUG: environ })
3631
});
3732

3833
expectErr = expectErr.split('%PID%').join(child.pid);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.