Force exit felt tool on sigint, sigterm (flutter/engine#12443)

This commit is contained in:
Yegor
2019-09-25 10:02:32 -07:00
committed by GitHub
parent 19e7aab9a1
commit f24162c6bf

View File

@@ -25,6 +25,8 @@ void main(List<String> 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<String> 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);
});
}