Missing runnable env on debug target

Fix bug in Rust Analyzer where runnable debugging did not pass
environment variable from configuration to child process of Cargo
on binary build stage
This commit is contained in:
Rungsikorn Rungsikavarnich 2023-03-30 15:22:20 +09:00
parent 17e31b7d3b
commit fb9a1dd87e
2 changed files with 12 additions and 4 deletions

View file

@ -18,7 +18,11 @@ export interface ArtifactSpec {
}
export class Cargo {
constructor(readonly rootFolder: string, readonly output: vscode.OutputChannel) {}
constructor(
readonly rootFolder: string,
readonly output: vscode.OutputChannel,
readonly env: Record<string, string>
) {}
// Made public for testing purposes
static artifactSpec(args: readonly string[]): ArtifactSpec {
@ -102,6 +106,7 @@ export class Cargo {
const cargo = cp.spawn(path, cargoArgs, {
stdio: ["ignore", "pipe", "pipe"],
cwd: this.rootFolder,
env: this.env,
});
cargo.on("error", (err) => reject(new Error(`could not launch cargo: ${err}`)));