| 336 | } |
| 337 | } |
| 338 | private async Shutdown() { |
| 339 | Logger.Get.Log('Shutting down. Waiting for recorder stops.'); |
| 340 | const StopRecorder = () => { |
| 341 | return new Promise<void>((resolve) => { |
| 342 | let awaitedRecordings = this.recorder.Records.length; |
| 343 | if (!awaitedRecordings) { |
| 344 | resolve(); |
| 345 | return; |
| 346 | } |
| 347 | this.pluginManager.Stop(); |
| 348 | this.recorder.Records |
| 349 | .map(r => r.label) |
| 350 | .forEach(l => this.recorder.StopRecording(l)); |
| 351 | this.recorderListener.CompleteEvent.On(() => { |
| 352 | if (--awaitedRecordings === 0) |
| 353 | resolve(); |
| 354 | }); |
| 355 | |
| 356 | }); |
| 357 | }; |
| 358 | await StopRecorder(); |
| 359 | Logger.Get.Log('Exit'); |
| 360 | process.exit(0); |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | const app = new App(); |