Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not use environment variables in "env" -> "PATH" setting? #242

Closed
4 tasks done
emmenlau opened this issue Dec 7, 2020 · 1 comment
Closed
4 tasks done

Can not use environment variables in "env" -> "PATH" setting? #242

emmenlau opened this issue Dec 7, 2020 · 1 comment

Comments

@emmenlau
Copy link

emmenlau commented Dec 7, 2020

Thanks so much for this awesome software!

Checklist

  • The issue is about this extension and NOT about a fork.
  • Check the known issues list.
  • The latest version of the extension was used.
  • It is not related to remote-vscode or I checked the following issue

Describe the bug

On Windows my test-executables need <TARGETDIR>/bin in the PATH to find required DLLs. I tried setting this up using environment variables but setting PATH with environment variables always fails for me. When the PATH is not set, then vscode-catch2-test-adapter can not find the tests, because the executables will not start.

Without variables, the detection works fine, see example below. Could you please help?

To Reproduce

Set environment variable BDASOFTTEMP_OSPATH="C:/data"

The following setting (with a hardcoded path) works well:

{
    "testMate.cpp.debug.breakOnFailure": false,
    "testMate.cpp.test.advancedExecutables": [
        {
            "name": "${filename}",
            "description": "(Test)",
            "pattern": "${os_env:BDASOFTTEMP_OSPATH}/Debug/BDABaseFunctions/*Test*",
            "env": {
                // The PATH is set with hardcoded "C:/data", this works:
                "PATH": "${os_env:PATH}${osPathEnvSep}C:/data/Debug/bin"
           }
        }
    ]
}

However, this setting with using ${os_env:BDASOFTTEMP_OSPATH} in PATH does not work. Note that the same variable works when its used in pattern, also in the example above. So the variable should be fine.

{
    "testMate.cpp.debug.breakOnFailure": false,
    "testMate.cpp.test.advancedExecutables": [
        {
            "name": "${filename}",
            "description": "(Test)",
            "pattern": "${os_env:BDASOFTTEMP_OSPATH}/Debug/BDABaseFunctions/*Test*",
            "env": {
                "PATH": "${os_env:PATH}${osPathEnvSep}${os_env:BDASOFTTEMP_OSPATH}/Debug/bin"
           }
        }
    ]
}

Desktop

  • Extension Version: 3.6.13
  • VS Code Version: 1.51.1
  • Catch2 / Google Test / DOCTest Version: Google Test 1.8.1
  • OS Type and Version: Windows 10 x64
  • Using remote-ssh/docker/wsl?: No

Log (optional but recommended)

I added the setting "testMate.cpp.log.logfile": "C:/data/testmate.log", to settings.json. But it should be enough to reload the tests to reproduce the problem with PATH. After reloading the tests a few times and closing and opening vscode, there is still no log. Maybe I'm doing something wrong?

@emmenlau
Copy link
Author

emmenlau commented Dec 7, 2020

Ok, for an unknown reason it is working now. I've re-ordered the PATH so that the new entries come at the front, then it works.

@emmenlau emmenlau closed this as completed Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant