Explicitly close ws in cases of a process exit
Summary: ^ There may be cases whereas the process exits but leaks the socket descriptors. There's already a hook to close flipper-server. Reviewed By: passy Differential Revision: D37550940 fbshipit-source-id: 35004969834bb92bb7cf0f56bda8d7b43c11d6bf
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ae90ce5878
commit
583fdd9648
@@ -18,6 +18,7 @@ import open from 'open';
|
||||
import {initCompanionEnv} from 'flipper-server-companion';
|
||||
import {startFlipperServer, startServer} from 'flipper-server-core';
|
||||
import {isTest} from 'flipper-common';
|
||||
import exitHook from 'exit-hook';
|
||||
|
||||
const argv = yargs
|
||||
.usage('yarn flipper-server [args]')
|
||||
@@ -115,6 +116,10 @@ async function start() {
|
||||
'external',
|
||||
);
|
||||
|
||||
exitHook(async () => {
|
||||
await flipperServer.close();
|
||||
});
|
||||
|
||||
enhanceLogger((logEntry) => {
|
||||
flipperServer.emit('server-log', logEntry);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user