about summary refs log tree commit diff
path: root/editors/code/src/tasks.ts
diff options
context:
space:
mode:
authorIgor Aleksanov <popzxc@yandex.ru>2020-09-05 16:21:14 +0300
committerIgor Aleksanov <popzxc@yandex.ru>2020-10-02 12:35:22 +0300
commit5b26629a4d8ca388db1b272a7c8b8ea37f45c9f9 (patch)
tree6d056f5658df00cff3c4acadf73d80f7d832d915 /editors/code/src/tasks.ts
parent4a1b4b23bb58398a7e2a955e0be43ff2c09fe9e5 (diff)
downloadrust-5b26629a4d8ca388db1b272a7c8b8ea37f45c9f9.tar.gz
rust-5b26629a4d8ca388db1b272a7c8b8ea37f45c9f9.zip
Support 'runnables' options in the vs code extension
Diffstat (limited to 'editors/code/src/tasks.ts')
-rw-r--r--editors/code/src/tasks.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/editors/code/src/tasks.ts b/editors/code/src/tasks.ts
index 14abbd5b794..a3ff1510256 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(