fix(doctor): find the Homebrew Hopper cask without writing Homebrew caches
`rea doctor`, documented as strictly read-only, ran `brew --prefix --cask hopper-disassembler` when Hopper was not in a standard location. Current Homebrew rejects that option combination, but any brew command naming a cask first fetches the cask API, so each doctor run wrote about 600 files (36 MB) into the user's Homebrew cache. Ask brew only for its Caskroom, which brew answers without loading the cask API, and read the application directory Homebrew recorded in the Hopper cask's install receipt. Fixes #1165 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4fb2f3e6ed
commit
a503376b2f
@@ -7,7 +7,7 @@ import { analysisErrorRemediationAction } from "../domain/analysisErrorPresentat
|
||||
import { parseBinaryTarget } from "./BinaryTargetResolver.js";
|
||||
import { execFileOutput } from "../process/ExecFileOutput.js";
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import { probeHomebrew } from "./homebrew.js";
|
||||
import { installedCaskAppdir, probeHomebrew } from "./homebrew.js";
|
||||
import {
|
||||
linuxHopperBinarySupported,
|
||||
linuxSharedLibrariesAvailable,
|
||||
@@ -380,20 +380,30 @@ export const systemDoctorHost = (
|
||||
supportedLinuxHopper: linuxHopperBinarySupported,
|
||||
async brewHopperPath() {
|
||||
return probeHomebrew(async (command) => {
|
||||
let caskroom: string;
|
||||
try {
|
||||
const prefix = (
|
||||
// Without a cask argument, `--caskroom` does not load Homebrew's
|
||||
// cask API, so doctor writes no Homebrew cache files.
|
||||
caskroom = (
|
||||
await hostExecFileOutput(
|
||||
command,
|
||||
["--prefix", "--cask", "hopper-disassembler"],
|
||||
["--caskroom"],
|
||||
commandEnvironment,
|
||||
)
|
||||
).stdout.trim();
|
||||
return `${prefix}/Hopper Disassembler.app/Contents/MacOS/hopper`;
|
||||
} catch (cause: unknown) {
|
||||
// best-effort cleanup: optional Homebrew probing; absence means uninstalled.
|
||||
void cause;
|
||||
return undefined;
|
||||
}
|
||||
const appdir = await installedCaskAppdir(
|
||||
caskroom,
|
||||
"hopper-disassembler",
|
||||
homeDirectory,
|
||||
);
|
||||
return appdir === undefined
|
||||
? undefined
|
||||
: join(appdir, "Hopper Disassembler.app/Contents/MacOS/hopper");
|
||||
});
|
||||
},
|
||||
manualHopperPaths: () => manualHopperPaths(homeDirectory),
|
||||
|
||||
Reference in New Issue
Block a user