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

10 lines
148 B
Crystal

LibC.signal Signal::INT.value, ->(s : Int32) {
puts "CTRL-C handler here!"
exit
}
Signal::INT.trap do
puts "CTRL-C handler here!"
exit
end