Close servers on exit

Summary: On exit, close the servers explicitly.

Reviewed By: lawrencelomax

Differential Revision: D37206986

fbshipit-source-id: 7f4313cce1db18e1fb1320993a58c440af2cc7e0
This commit is contained in:
Lorenzo Blasa
2022-06-20 03:27:19 -07:00
committed by Facebook GitHub Bot
parent 87bdff9c9b
commit b6bf7c6ee7

View File

@@ -121,6 +121,10 @@ async function startProxyServer(
console.log(`Starting proxy server on http://localhost:${config.port}`); console.log(`Starting proxy server on http://localhost:${config.port}`);
exitHook(() => { exitHook(() => {
console.log('Shutdown server');
proxyServer.close();
server.close();
console.log('Cleaning up socket on exit:', socketPath); console.log('Cleaning up socket on exit:', socketPath);
// This *must* run synchronously and we're not blocking any UI loop by definition. // This *must* run synchronously and we're not blocking any UI loop by definition.
// eslint-disable-next-line node/no-sync // eslint-disable-next-line node/no-sync