about summary refs log tree commit diff
path: root/editors/code/src/util.ts
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-15 11:38:44 +0000
committerbors <bors@rust-lang.org>2023-08-15 11:38:44 +0000
commitef2ee59631f9a0f62ff03b54befdef363675ceed (patch)
treea7d94f8da704a95e9f58a98d26cef7c85d92a8e3 /editors/code/src/util.ts
parentb771de3fdc1d0eed102336c2f76ca6ced07656ac (diff)
parente76d20e072cd25ca2df21ef51e973bf666f4c840 (diff)
downloadrust-ef2ee59631f9a0f62ff03b54befdef363675ceed.tar.gz
rust-ef2ee59631f9a0f62ff03b54befdef363675ceed.zip
Auto merge of #15446 - Veykril:checkOnSaveToggle, r=Veykril
Add status bar button to toggle check on save state

Closes https://github.com/rust-lang/rust-analyzer/issues/15440
cc https://github.com/rust-lang/rust-analyzer/issues/13208
Diffstat (limited to 'editors/code/src/util.ts')
-rw-r--r--editors/code/src/util.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts
index 38ce6761578..1e83c281a13 100644
--- a/editors/code/src/util.ts
+++ b/editors/code/src/util.ts
@@ -2,6 +2,7 @@ import * as vscode from "vscode";
 import { strict as nativeAssert } from "assert";
 import { exec, type ExecOptions, spawnSync } from "child_process";
 import { inspect } from "util";
+import type { Env } from "./client";
 
 export function assert(condition: boolean, explanation: string): asserts condition {
     try {
@@ -93,10 +94,13 @@ export function isDocumentInWorkspace(document: RustDocument): boolean {
     return false;
 }
 
-export function isValidExecutable(path: string): boolean {
+export function isValidExecutable(path: string, extraEnv: Env): boolean {
     log.debug("Checking availability of a binary at", path);
 
-    const res = spawnSync(path, ["--version"], { encoding: "utf8" });
+    const res = spawnSync(path, ["--version"], {
+        encoding: "utf8",
+        env: { ...process.env, ...extraEnv },
+    });
 
     const printOutput = res.error ? log.warn : log.info;
     printOutput(path, "--version:", res);