Skip to content

Commit 33f9250

Browse files
committed
Pass server extraEnv to isValidExecutable
1 parent 1b67823 commit 33f9250

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

editors/code/src/bootstrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export async function bootstrap(
2020

2121
log.info("Using server binary at", path);
2222

23-
if (!isValidExecutable(path)) {
23+
if (!isValidExecutable(path, config.serverExtraEnv)) {
2424
if (config.serverPath) {
2525
throw new Error(`Failed to execute ${path} --version. \`config.server.path\` or \`config.serverPath\` has been set explicitly.\
2626
Consider removing this config or making a valid server binary available at that path.`);

editors/code/src/util.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as vscode from "vscode";
22
import { strict as nativeAssert } from "assert";
33
import { exec, type ExecOptions, spawnSync } from "child_process";
44
import { inspect } from "util";
5+
import { Env } from "./client";
56

67
export function assert(condition: boolean, explanation: string): asserts condition {
78
try {
@@ -93,10 +94,13 @@ export function isDocumentInWorkspace(document: RustDocument): boolean {
9394
return false;
9495
}
9596

96-
export function isValidExecutable(path: string): boolean {
97+
export function isValidExecutable(path: string, extraEnv: Env): boolean {
9798
log.debug("Checking availability of a binary at", path);
9899

99-
const res = spawnSync(path, ["--version"], { encoding: "utf8" });
100+
const res = spawnSync(path, ["--version"], {
101+
encoding: "utf8",
102+
env: { ...process.env, ...extraEnv },
103+
});
100104

101105
const printOutput = res.error ? log.warn : log.info;
102106
printOutput(path, "--version:", res);

0 commit comments

Comments
 (0)