test(node-host): cache native binary fixture lookup

This commit is contained in:
Peter Steinberger
2026-04-25 20:17:10 +01:00
parent f34513ac66
commit 7436e395d5

View File

@@ -152,10 +152,16 @@ function uniqueRuntimeBinNames(
];
}
let cachedNativeBinaryFixturePath: string | undefined;
function resolveNativeBinaryFixturePath(): string {
if (cachedNativeBinaryFixturePath) {
return cachedNativeBinaryFixturePath;
}
for (const candidate of ["/bin/ls", "/usr/bin/ls", "/bin/echo", "/usr/bin/printf"]) {
try {
if (fs.statSync(candidate).isFile()) {
cachedNativeBinaryFixturePath = candidate;
return candidate;
}
} catch {