Skip to content

Commit

Permalink
Attempt to fix process tasks with Windows SSH host
Browse files Browse the repository at this point in the history
part of #82994
  • Loading branch information
alexr00 committed Oct 23, 2019
1 parent f71a0cf commit b059cbd
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,14 @@ export class TerminalTaskSystem implements ITaskSystem {
}
}

private resolveAndFindExecutable(workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, cwd: string | undefined, envPath: string | undefined): Promise<string> {
return this.findExecutable(
this.configurationResolverService.resolve(workspaceFolder, CommandString.value(task.command.name!)),
cwd ? this.configurationResolverService.resolve(workspaceFolder, cwd) : undefined,
envPath ? envPath.split(path.delimiter).map(p => this.configurationResolverService.resolve(workspaceFolder, p)) : undefined
);
}

private resolveVariablesFromSet(taskSystemInfo: TaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set<string>): Promise<ResolvedVariables> {
let isProcess = task.command && task.command.runtime === RuntimeType.Process;
let options = task.command && task.command.options ? task.command.options : undefined;
Expand Down Expand Up @@ -426,9 +434,13 @@ export class TerminalTaskSystem implements ITaskSystem {
resolveSet.process.path = envPath;
}
}
resolvedVariables = taskSystemInfo.resolveVariables(workspaceFolder, resolveSet).then(resolved => {
if ((taskSystemInfo.platform !== Platform.Platform.Windows) && isProcess) {
resolved.variables.set(TerminalTaskSystem.ProcessVarName, CommandString.value(task.command.name!));
resolvedVariables = taskSystemInfo.resolveVariables(workspaceFolder, resolveSet).then(async (resolved) => {
if (isProcess) {
let process = CommandString.value(task.command.name!);
if (taskSystemInfo.platform === Platform.Platform.Windows) {
process = await this.resolveAndFindExecutable(workspaceFolder, task, cwd, envPath);
}
resolved.variables.set(TerminalTaskSystem.ProcessVarName, process);
}
return Promise.resolve(resolved);
});
Expand All @@ -443,11 +455,7 @@ export class TerminalTaskSystem implements ITaskSystem {
if (isProcess) {
let processVarValue: string;
if (Platform.isWindows) {
processVarValue = await this.findExecutable(
this.configurationResolverService.resolve(workspaceFolder, CommandString.value(task.command.name!)),
cwd ? this.configurationResolverService.resolve(workspaceFolder, cwd) : undefined,
envPath ? envPath.split(path.delimiter).map(p => this.configurationResolverService.resolve(workspaceFolder, p)) : undefined
);
processVarValue = await this.resolveAndFindExecutable(workspaceFolder, task, cwd, envPath);
} else {
processVarValue = this.configurationResolverService.resolve(workspaceFolder, CommandString.value(task.command.name!));
}
Expand Down

0 comments on commit b059cbd

Please sign in to comment.