Add headless option to dump on disconnect

Summary:
This adds an optional exit strategy that reacts to the client disconnecting rather than a `SIGINT` which can be used for integration tests.

`MiddlewareAPI` is a subset of `Store` and required to work here.

Annoyingly, it's not quite clear to me why this does not work as part of an event loop cycle and requires a `setTimeout`. This doesn't have any negative effects and works in the same way that the SIGINT interruption works, but it's a bit of an eyesore.

Reviewed By: danielbuechele

Differential Revision: D14622111

fbshipit-source-id: e2caca056e478428d977565dc9bc09eefca4230c
This commit is contained in:
Pascal Hartig
2019-03-28 06:47:41 -07:00
committed by Facebook Github Bot
parent ddd06971f1
commit b20d0a4c8b
6 changed files with 58 additions and 28 deletions

View File

@@ -9,7 +9,7 @@ import type {KeyboardActions} from './MenuBar.js';
import type {App} from './App.js';
import type {Logger} from './fb-interfaces/Logger.js';
import type Client from './Client.js';
import type {Store} from './reducers/index.js';
import type {Store, MiddlewareAPI} from './reducers/index.js';
import React from 'react';
import type {Node} from 'react';
@@ -86,7 +86,7 @@ export class FlipperBasePlugin<
static exportPersistedState: ?(
callClient: (string, ?Object) => Promise<Object>,
persistedState: ?PersistedState,
store: ?Store,
store: ?MiddlewareAPI,
) => Promise<?PersistedState>;
static getActiveNotifications: ?(
persistedState: PersistedState,