Skip to content

Commit 47fecdb

Browse files
committed
fix: avoid doubling cargo args in runnables
1 parent 4af21ff commit 47fecdb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

editors/code/src/tasks.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as vscode from "vscode";
22
import * as toolchain from "./toolchain";
33
import type { Config } from "./config";
44
import { log } from "./util";
5-
import { unwrapUndefinable } from "./undefinable";
5+
import { expectNotUndefined, unwrapUndefinable } from "./undefinable";
66

77
// This ends up as the `type` key in tasks.json. RLS also uses `cargo` and
88
// our configuration should be compatible with it so use the same key.
@@ -145,11 +145,13 @@ async function cargoToExecution(
145145
const cargoPath = await toolchain.cargoPath();
146146
const cargoCommand = definition.overrideCargo?.split(" ") ?? [cargoPath];
147147

148-
const args = [definition.command].concat(definition.args ?? []);
149-
const fullCommand = [...cargoCommand, ...args];
150-
const processName = unwrapUndefinable(fullCommand[0]);
148+
const args = expectNotUndefined(
149+
definition.args,
150+
"args were not provided via runnables; this is a bug.",
151+
);
152+
const processName = unwrapUndefinable(cargoCommand[0]);
151153

152-
return new vscode.ProcessExecution(processName, fullCommand.slice(1), {
154+
return new vscode.ProcessExecution(processName, args, {
153155
cwd: definition.cwd,
154156
env: definition.env,
155157
});

0 commit comments

Comments
 (0)