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 c02bbdd

Browse filesBrowse files
alexcfyungruyadorno
authored andcommitted
lib: pass env variables to child process on z/OS
PR-URL: #42255 Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent 05802c2 commit c02bbdd
Copy full SHA for c02bbdd

File tree

Expand file treeCollapse file tree

1 file changed

+23
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+23
-3
lines changed
Open diff view settings
Collapse file

‎lib/child_process.js‎

Copy file name to clipboardExpand all lines: lib/child_process.js
+23-3Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ const {
9393

9494
const MAX_BUFFER = 1024 * 1024;
9595

96+
const isZOS = process.platform === 'os390';
97+
9698
/**
9799
* Spawns a new Node.js process + fork.
98100
* @param {string|URL} modulePath
@@ -524,6 +526,14 @@ ObjectDefineProperty(execFile, promisify.custom, {
524526
value: customPromiseExecFunction(execFile)
525527
});
526528

529+
function copyProcessEnvToEnv(env, name, optionEnv) {
530+
if (process.env[name] &&
531+
(!optionEnv ||
532+
!ObjectPrototypeHasOwnProperty(optionEnv, name))) {
533+
env[name] = process.env[name];
534+
}
535+
}
536+
527537
function normalizeSpawnArguments(file, args, options) {
528538
validateString(file, 'file');
529539

@@ -630,9 +640,19 @@ function normalizeSpawnArguments(file, args, options) {
630640

631641
// process.env.NODE_V8_COVERAGE always propagates, making it possible to
632642
// collect coverage for programs that spawn with white-listed environment.
633-
if (process.env.NODE_V8_COVERAGE &&
634-
!ObjectPrototypeHasOwnProperty(options.env || {}, 'NODE_V8_COVERAGE')) {
635-
env.NODE_V8_COVERAGE = process.env.NODE_V8_COVERAGE;
643+
copyProcessEnvToEnv(env, 'NODE_V8_COVERAGE', options.env);
644+
645+
if (isZOS) {
646+
// The following environment variables must always propagate if set.
647+
copyProcessEnvToEnv(env, '_BPXK_AUTOCVT', options.env);
648+
copyProcessEnvToEnv(env, '_CEE_RUNOPTS', options.env);
649+
copyProcessEnvToEnv(env, '_TAG_REDIR_ERR', options.env);
650+
copyProcessEnvToEnv(env, '_TAG_REDIR_IN', options.env);
651+
copyProcessEnvToEnv(env, '_TAG_REDIR_OUT', options.env);
652+
copyProcessEnvToEnv(env, 'STEPLIB', options.env);
653+
copyProcessEnvToEnv(env, 'LIBPATH', options.env);
654+
copyProcessEnvToEnv(env, '_EDC_SIG_DFLT', options.env);
655+
copyProcessEnvToEnv(env, '_EDC_SUSV3', options.env);
636656
}
637657

638658
let envKeys = [];

0 commit comments

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