Skip to content

Special symbols in .env file issue #50302

@osya

Description

@osya
  • VSCode Version: 1.23.1
  • OS Version: Windows 10 Pro x64

When you use .env file in the VS Code project and CMD.exe as terminal ("terminal.integrated.shell.windows": "cmd.exe") then for settings environment variables generated commands such as cmd /C "set "SECRET_KEY=uh_p8w$eo6%%tf5)d43b2y))88qxf2t9-s=osvq46u#3ya^p+" without escaping special symbols. Special symbols (such as & and ^) in the values of environment variables from the .env file in the set command should be escaped with the ^ symbol.

Steps to Reproduce:

  1. Create .env file with the following content SECRET_KEY=uh_p8w$eo6%%tf5)d43b2y))88qxf2&t9-s=osvq46u#3ya^p+
  2. Create some .py file
  3. Create launch configuration for Python and ensure "envFile": "${workspaceFolder}/.env" in it (.env file used by default, so may be adding this line is not necessary)
  4. Start debugging

In the Terminal the following error appears:

>cd c:\Users\info_000\Desktop && cmd /C "set "SECRET_KEY=uh_p8w$eo6%%tf5)d43b2y))88qxf2&t9-s=osvq46u#3ya^p+" && set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && python ...\.vscode\extensions\ms-python.python-2018.4.0\pythonFiles\PythonTools\visualstudio_py_launcher.py ...\Desktop 52380 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput ...\Desktop\.vscode\launch.json "
't9-s' is not recognized as an internal or external command,
operable program or batch file.

Does this issue occur when all extensions are disabled?: Yes

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugdebugDebug viewlet, configurations, breakpoints, adapter issuesverifiedVerification succeeded

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions