Fix compile race conditions

This commit is contained in:
Snarling
2022-08-19 18:21:31 -04:00
parent 07e9cb9277
commit 823cdf70ca
4 changed files with 37 additions and 51 deletions
@@ -285,10 +285,8 @@ export async function determineAllPossibilitiesForTabCompletion(
return processFilepath(script.filename) === fn || script.filename === "/" + fn;
});
if (!script) return; // Doesn't exist.
if (!script.module) {
await compile(p, script, currServ.scripts);
}
const loadedModule = await script.module;
//Will return the already compiled module if recompilation not needed.
const loadedModule = await compile(p, script, currServ.scripts);
if (!loadedModule || !loadedModule.autocomplete) return; // Doesn't have an autocomplete function.
const runArgs = { "--tail": Boolean, "-t": Number };