When someone presses Ctrl-c when running your Ruby script, the signal can be caught by Ruby:
trap "SIGINT" do
puts "Exiting"
exit 130
end130 is the common exit code for terminating with Ctrl-c.
Mar 13, 2026
When someone presses Ctrl-c when running your Ruby script, the signal can be caught by Ruby:
trap "SIGINT" do
puts "Exiting"
exit 130
end130 is the common exit code for terminating with Ctrl-c.