Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Signal::INT.trap do |x|
- if fg = Jobs.manager.fg
- fg.kill(Signal::INT)
- else
- puts "Got SIGINT, but there is no process in the foreground."
- end
- end
- # or
- Signal::INT.trap do |x|
- if !Jobs.manager.fg
- puts "Got SIGINT, but there is no process in the foreground."
- else
- Jobs.manager.fg.not_nil!.kill(Signal::INT)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement