Remove unused event listener after promise settlement in spawnDetachedProcess

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Cursor AgentandJulius Marminge committed 2026-03-05 23:05:17 +00:00
1 parent e5cea81fea
commit 30035f91dd
1 file changed
+7 -3
+7 -3
View File
@@ -364,14 +364,18 @@ export function spawnDetachedProcess(
});
const handleSpawn = () => {
child.removeListener("error", handleError);
child.unref();
resolve();
};
child.once("spawn", handleSpawn);
child.once("error", (error) => {
const handleError = (error: Error) => {
child.removeListener("spawn", handleSpawn);
reject(normalizeSpawnError(command, args, error));
});
};
child.once("spawn", handleSpawn);
child.once("error", handleError);
});
}