GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: pass env variables to child process on z/OS · nodejs/node@3dbbaa0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • child_process.js
Expand file treeCollapse file tree
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)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.