@@ -2,7 +2,7 @@ import * as vscode from "vscode";
2
2
import * as toolchain from "./toolchain" ;
3
3
import type { Config } from "./config" ;
4
4
import { log } from "./util" ;
5
- import { unwrapUndefinable } from "./undefinable" ;
5
+ import { expectNotUndefined , unwrapUndefinable } from "./undefinable" ;
6
6
7
7
// This ends up as the `type` key in tasks.json. RLS also uses `cargo` and
8
8
// our configuration should be compatible with it so use the same key.
@@ -142,14 +142,16 @@ async function cargoToExecution(
142
142
if ( definition . type === TASK_TYPE ) {
143
143
// Check whether we must use a user-defined substitute for cargo.
144
144
// Split on spaces to allow overrides like "wrapper cargo".
145
- const cargoPath = await toolchain . cargoPath ( ) ;
146
- const cargoCommand = definition . overrideCargo ?. split ( " " ) ?? [ cargoPath ] ;
145
+ const cargoCommand = definition . overrideCargo ?. split ( " " ) ?? [ definition . command ] ;
147
146
148
- const args = [ definition . command ] . concat ( definition . args ?? [ ] ) ;
149
- const fullCommand = [ ...cargoCommand , ...args ] ;
150
- const processName = unwrapUndefinable ( fullCommand [ 0 ] ) ;
147
+ const definitionArgs = expectNotUndefined (
148
+ definition . args ,
149
+ "args were not provided via runnables; this is a bug." ,
150
+ ) ;
151
+ const args = [ ...cargoCommand . slice ( 1 ) , ...definitionArgs ] ;
152
+ const processName = unwrapUndefinable ( cargoCommand [ 0 ] ) ;
151
153
152
- return new vscode . ProcessExecution ( processName , fullCommand . slice ( 1 ) , {
154
+ return new vscode . ProcessExecution ( processName , args , {
153
155
cwd : definition . cwd ,
154
156
env : definition . env ,
155
157
} ) ;
0 commit comments