From ca4c1bf7a0268ca7abaaf4bb7b99ba18dab8328d Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 5 Sep 2019 14:59:08 +0200 Subject: [PATCH] Go to ext host for system default shell and args for tasks Fixes https://github.com/microsoft/vscode-remote-release/issues/1203 --- src/vs/workbench/api/browser/mainThreadTask.ts | 3 +++ src/vs/workbench/api/common/extHost.protocol.ts | 1 + src/vs/workbench/api/node/extHostTask.ts | 4 ++++ src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts | 2 +- src/vs/workbench/contrib/tasks/common/taskSystem.ts | 3 ++- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadTask.ts b/src/vs/workbench/api/browser/mainThreadTask.ts index 7934efb088b..6fc2d150952 100644 --- a/src/vs/workbench/api/browser/mainThreadTask.ts +++ b/src/vs/workbench/api/browser/mainThreadTask.ts @@ -626,6 +626,9 @@ export class MainThreadTask implements MainThreadTaskShape { }); }); }); + }, + getDefaultShellAndArgs: (): Promise<{ shell: string, args: string[] | string | undefined }> => { + return Promise.resolve(this._proxy.$getDefaultShellAndArgs()); } }); } diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index fa06f7545ac..d208aca0e8c 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1185,6 +1185,7 @@ export interface ExtHostTaskShape { $onDidEndTaskProcess(value: tasks.TaskProcessEndedDTO): void; $OnDidEndTask(execution: tasks.TaskExecutionDTO): void; $resolveVariables(workspaceFolder: UriComponents, toResolve: { process?: { name: string; cwd?: string }, variables: string[] }): Promise<{ process?: string; variables: { [key: string]: string } }>; + $getDefaultShellAndArgs(): Thenable<{ shell: string, args: string[] | string | undefined }>; } export interface IBreakpointDto { diff --git a/src/vs/workbench/api/node/extHostTask.ts b/src/vs/workbench/api/node/extHostTask.ts index 2e194117598..ccf856d9d80 100644 --- a/src/vs/workbench/api/node/extHostTask.ts +++ b/src/vs/workbench/api/node/extHostTask.ts @@ -659,6 +659,10 @@ export class ExtHostTask implements ExtHostTaskShape { return result; } + public $getDefaultShellAndArgs(): Promise<{ shell: string, args: string[] | string | undefined }> { + return this._terminalService.$requestDefaultShellAndArgs(true); + } + private nextHandle(): number { return this._handleCounter++; } diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index e268caeeab6..f03460bfdee 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -778,7 +778,7 @@ export class TerminalTaskSystem implements ITaskSystem { let terminalName = this.createTerminalName(task); let originalCommand = task.command.name; if (isShellCommand) { - const defaultConfig = await this.terminalInstanceService.getDefaultShellAndArgs(true, platform); + const defaultConfig = variableResolver.taskSystemInfo ? await variableResolver.taskSystemInfo.getDefaultShellAndArgs() : await this.terminalInstanceService.getDefaultShellAndArgs(true, platform); shellLaunchConfig = { name: terminalName, executable: defaultConfig.shell, args: defaultConfig.args, waitOnExit }; let shellSpecified: boolean = false; let shellOptions: ShellConfiguration | undefined = task.command.options && task.command.options.shell; diff --git a/src/vs/workbench/contrib/tasks/common/taskSystem.ts b/src/vs/workbench/contrib/tasks/common/taskSystem.ts index e1ffe3a49c2..c844be5ec26 100644 --- a/src/vs/workbench/contrib/tasks/common/taskSystem.ts +++ b/src/vs/workbench/contrib/tasks/common/taskSystem.ts @@ -119,6 +119,7 @@ export interface TaskSystemInfo { context: any; uriProvider: (this: void, path: string) => URI; resolveVariables(workspaceFolder: IWorkspaceFolder, toResolve: ResolveSet): Promise; + getDefaultShellAndArgs(): Promise<{ shell: string, args: string[] | string | undefined }>; } export interface TaskSystemInfoResolver { @@ -137,4 +138,4 @@ export interface ITaskSystem { terminateAll(): Promise; revealTask(task: Task): boolean; customExecutionComplete(task: Task, result: number): Promise; -} \ No newline at end of file +}