From 5b26629a4d8ca388db1b272a7c8b8ea37f45c9f9 Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Sat, 5 Sep 2020 16:21:14 +0300 Subject: Support 'runnables' options in the vs code extension --- editors/code/src/tasks.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'editors/code/src/tasks.ts') diff --git a/editors/code/src/tasks.ts b/editors/code/src/tasks.ts index 14abbd5b7..a3ff15102 100644 --- a/editors/code/src/tasks.ts +++ b/editors/code/src/tasks.ts @@ -13,6 +13,7 @@ export interface CargoTaskDefinition extends vscode.TaskDefinition { args?: string[]; cwd?: string; env?: { [key: string]: string }; + overrideCargo?: string; } class CargoTaskProvider implements vscode.TaskProvider { @@ -98,7 +99,14 @@ export async function buildCargoTask( } if (!exec) { - exec = new vscode.ShellExecution(toolchain.cargoPath(), args, definition); + // Check whether we must use a user-defined substitute for cargo. + const cargoCommand = definition.overrideCargo ? definition.overrideCargo : toolchain.cargoPath(); + + // Prepare the whole command as one line. It is required if user has provided override command which contains spaces, + // for example "wrapper cargo". Without manual preparation the overridden command will be quoted and fail to execute. + const fullCommand = [cargoCommand, ...args].join(" "); + + exec = new vscode.ShellExecution(fullCommand, definition); } return new vscode.Task( -- cgit v1.2.3