From e97b93abeb530d4a643db340e354ed0f4d712754 Mon Sep 17 00:00:00 2001 From: cha0s Date: Mon, 12 Feb 2024 00:59:21 -0600 Subject: [PATCH] chore: tidy --- packages/server/test/server/build/build.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/server/test/server/build/build.js b/packages/server/test/server/build/build.js index 3a49960..6501e83 100644 --- a/packages/server/test/server/build/build.js +++ b/packages/server/test/server/build/build.js @@ -72,10 +72,13 @@ export async function startServer({ }, }, ); + server.on('exit', async () => { + socketServer.close(); + }); if (failOnErrorCode) { const stderr = pipesink(server.stderr); server.on('exit', async (code) => { - if (0 !== code) { + if (!server.done && 0 !== code) { const buffer = await stderr; if (!process.stderr.write(buffer)) { await new Promise((resolve, reject) => { @@ -116,7 +119,9 @@ export function withServer(task, options) { ); return results; }; - return task({server, socket}); + await task({server, socket}); + server.child.done = true; + server.child.kill(); }; }