diff options
Diffstat (limited to 'extension')
-rw-r--r-- | extension/src/activation/environmentSetup.ts | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 8818c949..32dfa52f 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -226,15 +226,29 @@ export async function startContinuePythonServer() { // Run the executable console.log("Starting Continue server"); - const child = spawn(destination, { - detached: true, - stdio: "ignore", - }); - child.on("error", (err: any) => { - console.error("Failed to start subprocess.", err); - }); - - child.unref(); + let attempts = 0; + let maxAttempts = 5; + let delay = 1000; // Delay between each attempt in milliseconds + + const spawnChild = () => { + const child = spawn(destination, { + detached: true, + stdio: "ignore", + }); + + child.on("error", (err: any) => { + if (err.code === "EBUSY" && attempts < maxAttempts) { + attempts++; + console.log(`EBUSY error caught. Retrying attempt ${attempts}...`); + setTimeout(spawnChild, delay); + } else { + console.error("Failed to start subprocess.", err); + } + }); + child.unref(); + }; + + spawnChild(); // Write the current version of vscode extension to a file called server_version.txt fs.writeFileSync(serverVersionPath(), getExtensionVersion()); |