Remove unused event listener after promise settlement in spawnDetachedProcess
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
e5cea81fea
commit
30035f91dd
1 file changed
+7
-3
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user