DavidSchuldenfrei / gtest-adapter

Other
18 stars 9 forks source link

environment variable not working #4

Closed jontte75 closed 6 years ago

jontte75 commented 6 years ago

Hello, Environment variable(s) defined in debug-configuration doesn't seem to be handled by gtest-adapter? The variable seems to be handled OK by debugger, since unittest starts fine if pressing "debug" in test explorer. But if pressing refresh (to get the list of cases), running the unittest fails, because of missing environment variable (LD_LIBRARY_PATH).

I'm using Ubuntu 16.04

Br Joni

DavidSchuldenfrei commented 6 years ago

Hi, Thanks for reporting on this issue. This is indeed a bug I hadn't thought of. It is now fixed in version 1.0.6

jontte75 commented 6 years ago

Hi, Thanks for quick answer and fix. It still doesn't seem to work though. Could it be that launch.json environment variable is in format:

            "environment": [{
                "name": "LD_LIBRARY_PATH",
                "value": "/path/to/some/lib/:/path/to/some/other/lib/"
            }],

but execSync takes env as key-value-pairs or something like that?

Hardcoded the LD_LIBRARY_PATH like this:

            var productionEnv = Object.create(process.env);
            productionEnv.LD_LIBRARY_PATH = '/some/path/lib/';
            var results = child_process_1.execSync(config.program + '  --gtest_list_tests', { encoding: "utf8", env: productionEnv })
                .split(/[\r\n]+/g);

And with that, the list-tests worked fine.

I have though very little experience in node.js and javascript, so I might be very wrong :-)

t. Joni

DavidSchuldenfrei commented 6 years ago

Thanks for bringing this to my attention. I believe that it is fixed now. However, I don't have a Ubuntu set up, at hand. Please let me know if you encounter further issues.

jontte75 commented 6 years ago

Seems to work fine now! Thanks, and keep up the good work!