Repository: microsoft/vscode (TypeScript)
Date: 2022-06-01 00:15:53+00:00
Task type: Bug Fix

Issue:
json string as launch argument broke in version 1.67.2
<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes/No

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.67.2
- OS Version: Windows_NT x64 10.0.22000 (Debian Bullseye WSL2)

I think #149283 broke my workflow. I provide an escaped json string as arg to python application, but since version 1.67.2, the argument is split rather than maintained as json string.

Steps to Reproduce:

1.
```
# launch.json
{
            "name": "Python: launch",
            "type": "python",
            "request": "launch",
            "program": "./main.py",
            "cwd": "${workspaceFolder}/src",
            "args": [
                "{\"environment\":\"${input:environment}\",\"run_id\":\"${input:run_id}\",\"run_timestamp\":\"${input:run_timestamp}\"}"
            ],
            "console": "integratedTerminal"
        }
```
2. Rather than maintaining json string, the args are split
![image](https://user-images.githubusercontent.com/51120533/171121404-0a5d26fc-234f-4493-9bd5-20520a45e117.png)





Issue discussion:
Sorry, I missed escaping `{}`

Solution patch:
diff --git a/src/vs/workbench/contrib/debug/node/terminals.ts b/src/vs/workbench/contrib/debug/node/terminals.ts
--- a/src/vs/workbench/contrib/debug/node/terminals.ts
+++ b/src/vs/workbench/contrib/debug/node/terminals.ts
@@ -161,7 +161,7 @@ export function prepareCommand(shell: string, args: string[], cwd?: string, env?
 		case ShellType.bash: {
 
 			quote = (s: string) => {
-				s = s.replace(/(["'\\\$!><#()\[\]*&^| ;])/g, '\\$1');
+				s = s.replace(/(["'\\\$!><#()\[\]*&^| ;{}`])/g, '\\$1');
 				return s.length === 0 ? `""` : s;
 			};
 


Test patch:
diff --git a/src/vs/workbench/contrib/debug/test/node/terminals.test.ts b/src/vs/workbench/contrib/debug/test/node/terminals.test.ts
--- a/src/vs/workbench/contrib/debug/test/node/terminals.test.ts
+++ b/src/vs/workbench/contrib/debug/test/node/terminals.test.ts
@@ -11,7 +11,7 @@ suite('Debug - prepareCommand', () => {
 	test('bash', () => {
 		assert.strictEqual(
 			prepareCommand('bash', ['{$} (']).trim(),
-			'{\\$}\\ \\(');
+			'\\{\\$\\}\\ \\(');
 		assert.strictEqual(
 			prepareCommand('bash', ['hello', 'world', '--flag=true']).trim(),
 			'hello world --flag=true');