Shutdown flipper-server on Flipper Desktop launch
Summary: At launch, if flipper-server is running, send the shutdown message. Reviewed By: passy Differential Revision: D38861178 fbshipit-source-id: 4aab5f2b50938cb70a2dfae0d9056df337baecc3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0aa1f14536
commit
fbbb793497
@@ -107,15 +107,20 @@ async function getFlipperServer(
|
||||
const settings = await loadSettings();
|
||||
|
||||
const socketPath = await makeSocketPath();
|
||||
const serverRunning = await checkSocketInUse(socketPath);
|
||||
let serverRunning = await checkSocketInUse(socketPath);
|
||||
|
||||
if (serverRunning) {
|
||||
console.info(
|
||||
'flipper-server: currently running/listening, attempt to shutdown',
|
||||
);
|
||||
const server = await getExternalServer(socketPath);
|
||||
await server.exec('shutdown').catch(() => {
|
||||
/** shutdown will ultimately make this request fail, ignore error. */
|
||||
});
|
||||
serverRunning = false;
|
||||
}
|
||||
|
||||
const getEmbeddedServer = async () => {
|
||||
if (serverRunning) {
|
||||
const server = await getExternalServer(socketPath);
|
||||
await server.exec('shutdown').catch(() => {
|
||||
/** shutdown will ultimately make this request fail, ignore error. */
|
||||
});
|
||||
}
|
||||
const server = new FlipperServerImpl(
|
||||
{
|
||||
environmentInfo,
|
||||
|
||||
Reference in New Issue
Block a user