mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
parent
920fc15008
commit
327c71fdef
|
@ -1128,13 +1128,9 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
|||
toAdd.push('-c');
|
||||
}
|
||||
}
|
||||
toAdd.forEach(element => {
|
||||
if (!shellArgs.some(arg => arg.toLowerCase() === element)) {
|
||||
shellArgs.push(element);
|
||||
}
|
||||
});
|
||||
shellArgs.push(commandLine);
|
||||
shellLaunchConfig.args = windowsShellArgs ? shellArgs.join(' ') : shellArgs;
|
||||
const combinedShellArgs = this.addAllArgument(toAdd, shellArgs);
|
||||
combinedShellArgs.push(commandLine);
|
||||
shellLaunchConfig.args = windowsShellArgs ? combinedShellArgs.join(' ') : combinedShellArgs;
|
||||
if (task.command.presentation && task.command.presentation.echo) {
|
||||
if (needsFolderQualification && workspaceFolder) {
|
||||
shellLaunchConfig.initialText = `\x1b[1m> Executing task in folder ${workspaceFolder.name}: ${commandLine} <\x1b[0m\n`;
|
||||
|
@ -1196,6 +1192,24 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
|||
return shellLaunchConfig;
|
||||
}
|
||||
|
||||
private addAllArgument(shellCommandArgs: string[], configuredShellArgs: string[]): string[] {
|
||||
const combinedShellArgs: string[] = Objects.deepClone(configuredShellArgs);
|
||||
shellCommandArgs.forEach(element => {
|
||||
const shouldAddShellCommandArg = configuredShellArgs.every((arg, index) => {
|
||||
if ((arg.toLowerCase() === element) && (configuredShellArgs.length > index + 1)) {
|
||||
// We can still add the argument, but only if not all of the following arguments begin with "-".
|
||||
return !configuredShellArgs.slice(index + 1).every(testArg => testArg.startsWith('-'));
|
||||
} else {
|
||||
return arg.toLowerCase() !== element;
|
||||
}
|
||||
});
|
||||
if (shouldAddShellCommandArg) {
|
||||
combinedShellArgs.push(element);
|
||||
}
|
||||
});
|
||||
return combinedShellArgs;
|
||||
}
|
||||
|
||||
private async doCreateTerminal(group: string | undefined, launchConfigs: IShellLaunchConfig): Promise<ITerminalInstance> {
|
||||
if (group) {
|
||||
// Try to find an existing terminal to split.
|
||||
|
|
Loading…
Reference in a new issue