Kill PortForwardingApp on exit

Summary:
I noticed we were not killing the PortForwardingApp on exit.

This is not ideal.

So, use an exit hook to kill the app.

Reviewed By: passy

Differential Revision: D46392855

fbshipit-source-id: e2b75f76c9dfab0ff46df3ad2c94a1a523154b2a
This commit is contained in:
Lorenzo Blasa
2023-06-02 07:55:56 -07:00
committed by Facebook GitHub Bot
parent c01b6b9f16
commit 828d56f617

View File

@@ -23,6 +23,7 @@ import {
import {FlipperServerImpl} from '../../FlipperServerImpl';
import {getFlipperServerConfig} from '../../FlipperServerConfig';
import iOSCertificateProvider from './iOSCertificateProvider';
import exitHook from 'exit-hook';
export class IOSDeviceManager {
private portForwarders: Array<ChildProcess> = [];
@@ -73,6 +74,11 @@ export class IOSDeviceManager {
console.log(`[conn] Port forwarding app exited gracefully`);
}
});
exitHook(() => {
child.kill('SIGKILL');
});
return child;
}