Skip to content

test-net-GH-5504.js is failing because environment variables are missing #3183

Closed
@john-yan

Description

@john-yan

In test https://github.com/nodejs/node/blob/master/test/sequential/test-net-GH-5504.js

   var opt = {
     env: {
       NODE_DEBUG: 'net',
       NODE_COMMON_PORT: process.env.NODE_COMMON_PORT,
     }
   };
   ...
   var s = spawn(node, [__filename, 'server'], opt);

This code loses the original environment variables passing into the program, which causes failure for the spawn function. Specifically, the program could not start because the loader couldn't find the correct version of standard c++ library which is not in the default location. The loader is supposed to find the needed libraries thought LD_LIBRARY_PATH environment variable which is missing.

I suggests to change the above code to this instead:

   var opt = {
     env: process.env
   };
   opt.env.NODE_DEBUG = "net";
   opt.env.NODE_COMMON_PORT = process.env.NODE_COMMON_PORT;

Metadata

Metadata

Assignees

No one assigned

    Labels

    testIssues and PRs related to the tests.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions