cours0708/P5B/ruby/161007/testSig_1.rb

18 lines
338 B
Ruby
Raw Normal View History

2008-11-25 21:11:16 +00:00
#!/usr/bin/ruby -w
nsec=0
trap("SIGINT" ){ #attention a la place de la parenthese ouvrante
puts "\n"+nsec.to_s + " secondes ecoulees \n"
}
trap("SIGQUIT" ){ #attention a la place de la parenthese ouvrante
puts "\nFin du chronom<6F>tre "+nsec.to_s + " secondes ecoulees \n"
exit
}
while true
sleep 1
nsec = nsec + 1
end