Skip to content

Commit 24d703a

Browse files
authored
Fix quoting for tasks (microsoft#142400)
Fixes microsoft#142196
1 parent 0a21487 commit 24d703a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,8 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
13531353
}
13541354

13551355
private buildShellCommandLine(platform: Platform.Platform, shellExecutable: string, shellOptions: ShellConfiguration | undefined, command: CommandString, originalCommand: CommandString | undefined, args: CommandString[]): string {
1356-
let shellQuoteOptions = this.getQuotingOptions(shellExecutable, shellOptions, platform);
1356+
const basename = path.parse(shellExecutable).name.toLowerCase();
1357+
const shellQuoteOptions = this.getQuotingOptions(basename, shellOptions, platform);
13571358

13581359
function needsQuotes(value: string): boolean {
13591360
if (value.length >= 2) {
@@ -1440,9 +1441,9 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
14401441
let commandLine = result.join(' ');
14411442
// There are special rules quoted command line in cmd.exe
14421443
if (platform === Platform.Platform.Windows) {
1443-
if (shellExecutable === 'cmd' && commandQuoted && argQuoted) {
1444+
if (basename === 'cmd' && commandQuoted && argQuoted) {
14441445
commandLine = '"' + commandLine + '"';
1445-
} else if ((shellExecutable === 'powershell' || shellExecutable === 'pwsh') && commandQuoted) {
1446+
} else if ((basename === 'powershell' || basename === 'pwsh') && commandQuoted) {
14461447
commandLine = '& ' + commandLine;
14471448
}
14481449
}

0 commit comments

Comments
 (0)