diff --git a/lib/web_ui/dev/felt.dart b/lib/web_ui/dev/felt.dart index 4b49a7506002b..ca9eafbb3d0a5 100644 --- a/lib/web_ui/dev/felt.dart +++ b/lib/web_ui/dev/felt.dart @@ -25,6 +25,8 @@ void main(List args) async { io.exit(64); // Exit code 64 indicates a usage error. } + _listenToShutdownSignals(); + try { final bool result = await runner.run(args); if (result == false) { @@ -41,3 +43,14 @@ void main(List args) async { // Sometimes the Dart VM refuses to quit. io.exit(io.exitCode); } + +void _listenToShutdownSignals() { + io.ProcessSignal.sigint.watch().listen((_) { + print('Received SIGINT. Shutting down.'); + io.exit(1); + }); + io.ProcessSignal.sigterm.watch().listen((_) { + print('Received SIGTERM. Shutting down.'); + io.exit(1); + }); +}