Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Shutdown flipper-server on Flipper Desktop launch
Browse files Browse the repository at this point in the history
Summary: At launch, if flipper-server is running, send the shutdown message.

Reviewed By: passy

Differential Revision: D38861178

fbshipit-source-id: 4aab5f2b50938cb70a2dfae0d9056df337baecc3
  • Loading branch information
lblasa authored and facebook-github-bot committed Aug 19, 2022
1 parent 0aa1f14 commit fbbb793
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions desktop/app/src/init.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fbbb793

Please sign in to comment.