Is there a way to catch CTRL+C in dart console application?
For example, press CTRL+C to send clean “closing” packet to web socket clients from server instead of just brutally closing the sockets.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ve had a dig around, and I think that the answer, at the moment is no.
You can capture stdin, for example:
but this does not respond to CTRL+C.
Elsewhere,
process.dart(part of thedart:iolibrary) defines various signals, such as SIGQUIT, and anonExit()callback, but this is used to control child processes rather than the host process.