Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Probe cache: read execCli at each call, so a test's replacement is the one that runs

milind-soni822d449e3de2
diff --git a/server/cli-probe-cache.ts b/server/cli-probe-cache.ts
index 2cb8f2d524..c8ea835808 100644
--- a/server/cli-probe-cache.ts
+++ b/server/cli-probe-cache.ts
@@ -102,7 +102,7 @@ function readEntries(file: string): Map<string, Entry> {
* is unchanged, else run, and kept when it succeeds with some output. The callback gets exactly what a run would give.
*/
export function createCliProbeCache(options: { file: string | null; appVersion: string; run?: ExecCli; platform?: NodeJS.Platform }) {
- const run = options.run ?? execCli;
+ const run: ExecCli = (...args) => (options.run ?? execCli)(...args); // read at each call: tests replace execCli
const platform = options.platform ?? process.platform;
let entries: Map<string, Entry> | null = null;
const loaded = () => (entries ??= options.file ? readEntries(options.file) : new Map());