about summary refs log tree commit diff
path: root/editors/code/src/tasks.ts
diff options
context:
space:
mode:
authorveetaha <veetaha2@gmail.com>2020-05-23 04:58:22 +0300
committerveetaha <veetaha2@gmail.com>2020-05-31 03:10:23 +0300
commit030d78345fa79af07f8ebd89a9d244576fac992b (patch)
tree935da29fbb0418e8158e06f227f238bda13ee55f /editors/code/src/tasks.ts
parent5f7225446e75509ae0d971a6f3e2b9d3e37d6f2a (diff)
downloadrust-030d78345fa79af07f8ebd89a9d244576fac992b.tar.gz
rust-030d78345fa79af07f8ebd89a9d244576fac992b.zip
Fix invoking cargo without consulting CARGO or standard installation paths
Diffstat (limited to 'editors/code/src/tasks.ts')
-rw-r--r--editors/code/src/tasks.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/editors/code/src/tasks.ts b/editors/code/src/tasks.ts
index 1366c76d6bd..c22d693623f 100644
--- a/editors/code/src/tasks.ts
+++ b/editors/code/src/tasks.ts
@@ -1,4 +1,5 @@
 import * as vscode from 'vscode';
+import { getCargoPathOrFail } from "./cargo";
 
 // This ends up as the `type` key in tasks.json. RLS also uses `cargo` and
 // our configuration should be compatible with it so use the same key.
@@ -24,6 +25,8 @@ class CargoTaskProvider implements vscode.TaskProvider {
         // set of tasks that always exist. These tasks cannot be removed in
         // tasks.json - only tweaked.
 
+        const cargoPath = getCargoPathOrFail();
+
         return [
             { command: 'build', group: vscode.TaskGroup.Build },
             { command: 'check', group: vscode.TaskGroup.Build },
@@ -46,7 +49,7 @@ class CargoTaskProvider implements vscode.TaskProvider {
                     `cargo ${command}`,
                     'rust',
                     // What to do when this command is executed.
-                    new vscode.ShellExecution('cargo', [command]),
+                    new vscode.ShellExecution(cargoPath, [command]),
                     // Problem matchers.
                     ['$rustc'],
                 );
@@ -80,4 +83,4 @@ class CargoTaskProvider implements vscode.TaskProvider {
 export function activateTaskProvider(target: vscode.WorkspaceFolder): vscode.Disposable {
     const provider = new CargoTaskProvider(target);
     return vscode.tasks.registerTaskProvider(TASK_TYPE, provider);
-}
\ No newline at end of file
+}