From 2e9ab310bd135e94b806916412d447c0e9ee3de9 Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Tue, 21 Jun 2022 04:46:42 -0700 Subject: [PATCH] Shutdown command Summary: Introduce a 'shutdown' command which effectively kills the process. Killing the process, for flipper-server, will close down the server and active ws connections. Reviewed By: passy Differential Revision: D37209193 fbshipit-source-id: 83303e8209530a41ba870009603cfb383915b7a6 --- desktop/flipper-common/src/server-types.tsx | 1 + desktop/flipper-server-core/src/FlipperServerImpl.tsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/desktop/flipper-common/src/server-types.tsx b/desktop/flipper-common/src/server-types.tsx index 8aa620564..597e25a11 100644 --- a/desktop/flipper-common/src/server-types.tsx +++ b/desktop/flipper-common/src/server-types.tsx @@ -299,6 +299,7 @@ export type FlipperServerCommands = { 'intern-upload-scribe-logs': ( messages: {category: string; message: string}[], ) => Promise; + shutdown: () => Promise; }; export type GraphResponse = { diff --git a/desktop/flipper-server-core/src/FlipperServerImpl.tsx b/desktop/flipper-server-core/src/FlipperServerImpl.tsx index 29fe4748c..213e6493c 100644 --- a/desktop/flipper-server-core/src/FlipperServerImpl.tsx +++ b/desktop/flipper-server-core/src/FlipperServerImpl.tsx @@ -478,6 +478,9 @@ export class FlipperServerImpl implements FlipperServer { return internGraphGETAPIRequest(endpoint, params, options, token); }, 'intern-upload-scribe-logs': sendScribeLogs, + shutdown: async () => { + process.exit(0); + }, }; registerDevice(device: ServerDevice) {