mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Also escape pipe character in bash shell. #145265
This commit is contained in:
parent
87191b089d
commit
d7dbb0b8a2
|
@ -121,7 +121,7 @@ export function prepareCommand(shell: string, args: string[], cwd?: string, env?
|
|||
|
||||
quote = (s: string) => {
|
||||
s = s.replace(/\"/g, '""');
|
||||
s = s.replace(/([><!^&\|])/g, '^$1');
|
||||
s = s.replace(/([><!^&|])/g, '^$1');
|
||||
return (' "'.split('').some(char => s.includes(char)) || s.length === 0) ? `"${s}"` : s;
|
||||
};
|
||||
|
||||
|
@ -139,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}" && `;
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,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 (' ;'.split('').some(char => s.includes(char)) || s.length === 0) ? `"${s}"` : s;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue