diff --git a/desktop/app/src/init.tsx b/desktop/app/src/init.tsx index 9c7ad9c30fa..002ba502782 100644 --- a/desktop/app/src/init.tsx +++ b/desktop/app/src/init.tsx @@ -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,