snipplets.dev/snipplets/code/Crystal/ctrl-c_interrupt.cr

10 lines
148 B
Crystal
Raw Normal View History

2023-06-11 18:45:45 +03:00
LibC.signal Signal::INT.value, ->(s : Int32) {
puts "CTRL-C handler here!"
exit
}
Signal::INT.trap do
puts "CTRL-C handler here!"
exit
end