Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/vs/workbench/contrib/debug/node/terminals.ts')
-rw-r--r--src/vs/workbench/contrib/debug/node/terminals.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vs/workbench/contrib/debug/node/terminals.ts b/src/vs/workbench/contrib/debug/node/terminals.ts
index c27c88f27a6..5418d9e8ffc 100644
--- a/src/vs/workbench/contrib/debug/node/terminals.ts
+++ b/src/vs/workbench/contrib/debug/node/terminals.ts
@@ -121,7 +121,8 @@ export function prepareCommand(shell: string, args: string[], cwd?: string, env?
quote = (s: string) => {
s = s.replace(/\"/g, '""');
- return (s.indexOf(' ') >= 0 || s.indexOf('"') >= 0 || s.length === 0) ? `"${s}"` : s;
+ s = s.replace(/([><!^&|])/g, '^$1');
+ return (' "'.split('').some(char => s.includes(char)) || s.length === 0) ? `"${s}"` : s;
};
if (cwd) {
@@ -138,7 +139,7 @@ export function prepareCommand(shell: string, args: string[], cwd?: string, env?
if (value === null) {
command += `set "${key}=" && `;
} else {
- value = value.replace(/[\^\&\|\<\>]/g, s => `^${s}`);
+ value = value.replace(/[&^|<>]/g, s => `^${s}`);
command += `set "${key}=${value}" && `;
}
}
@@ -154,8 +155,8 @@ export function prepareCommand(shell: string, args: string[], cwd?: string, env?
case ShellType.bash: {
quote = (s: string) => {
- s = s.replace(/(["'\\\$])/g, '\\$1');
- return (s.indexOf(' ') >= 0 || s.indexOf(';') >= 0 || s.length === 0) ? `"${s}"` : s;
+ s = s.replace(/(["'\\\$!><#()\[\]*&^|])/g, '\\$1');
+ return (' ;'.split('').some(char => s.includes(char)) || s.length === 0) ? `"${s}"` : s;
};
const hardQuote = (s: string) => {