Community discussions

MikroTik App
 
Tal
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Wed Jun 17, 2015 2:17 am

Catch Ctrl+C (Interrupted Signal)

Thu Aug 20, 2015 6:57 am

Is there any way to catch a Ctrl+C and clean up before exiting a script?

I tried:
do { :delay 2 } on-error={ :put "Test" }
But that didn't work - when you interrupt the command with Ctrl+C while it's running, there is no output.
Any proper way to do it?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7198
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Catch Ctrl+C (Interrupted Signal)

Thu Aug 20, 2015 1:19 pm

You can't because ctrl-c is interactive.