diff --git a/src/vs/workbench/contrib/debug/node/terminals.ts b/src/vs/workbench/contrib/debug/node/terminals.ts index c27c88f27a6..5f89e708bc7 100644 --- a/src/vs/workbench/contrib/debug/node/terminals.ts +++ b/src/vs/workbench/contrib/debug/node/terminals.ts @@ -121,7 +121,7 @@ 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; + return (' "> s.includes(char)) || s.length === 0) ? `"${s}"` : s; }; if (cwd) { @@ -154,8 +154,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) => {