未验证 提交 0bfca375 编写于 作者: Y Yegor 提交者: GitHub

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

上级 d7c69c16
......@@ -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);
});
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册