File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export async function bootstrap(
20
20
21
21
log . info ( "Using server binary at" , path ) ;
22
22
23
- if ( ! isValidExecutable ( path ) ) {
23
+ if ( ! isValidExecutable ( path , config . serverExtraEnv ) ) {
24
24
if ( config . serverPath ) {
25
25
throw new Error ( `Failed to execute ${ path } --version. \`config.server.path\` or \`config.serverPath\` has been set explicitly.\
26
26
Consider removing this config or making a valid server binary available at that path.` ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as vscode from "vscode";
2
2
import { strict as nativeAssert } from "assert" ;
3
3
import { exec , type ExecOptions , spawnSync } from "child_process" ;
4
4
import { inspect } from "util" ;
5
+ import { Env } from "./client" ;
5
6
6
7
export function assert ( condition : boolean , explanation : string ) : asserts condition {
7
8
try {
@@ -93,10 +94,13 @@ export function isDocumentInWorkspace(document: RustDocument): boolean {
93
94
return false ;
94
95
}
95
96
96
- export function isValidExecutable ( path : string ) : boolean {
97
+ export function isValidExecutable ( path : string , extraEnv : Env ) : boolean {
97
98
log . debug ( "Checking availability of a binary at" , path ) ;
98
99
99
- const res = spawnSync ( path , [ "--version" ] , { encoding : "utf8" } ) ;
100
+ const res = spawnSync ( path , [ "--version" ] , {
101
+ encoding : "utf8" ,
102
+ env : { ...process . env , ...extraEnv } ,
103
+ } ) ;
100
104
101
105
const printOutput = res . error ? log . warn : log . info ;
102
106
printOutput ( path , "--version:" , res ) ;
You can’t perform that action at this time.
0 commit comments