SHARE
TWEET

Gérer CTRL+C en Eiffel

a guest Apr 25th, 2018 146 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. note
  2.     description: "Montre comment fermer un application avec CTRL+C sans exception."
  3.     autheur: "Louis Marchand"
  4.     date: "Wed, 25 Apr 2018 23:12:33 +0000"
  5.     revision: "0.1"
  6.  
  7. class
  8.     APPLICATION
  9.  
  10. inherit
  11.     EXCEPTIONS
  12.  
  13. create
  14.     make
  15.  
  16. feature {NONE} -- Initialisation
  17.  
  18.     make
  19.             -- Exécute l'application.
  20.         local
  21.             l_ctrl_c:BOOLEAN
  22.         do
  23.             if not l_ctrl_c then
  24.                 from until False loop
  25.                     io.standard_default.put_string ("Appuyez sur CTRL+C%N")
  26.                     io.input.read_line
  27.                 end
  28.             else
  29.                 io.standard_default.put_string ("%NFermeture...%N")
  30.             end
  31.         rescue
  32.             if attached {OPERATING_SYSTEM_SIGNAL_FAILURE} Exception_manager.last_exception then
  33.                 l_ctrl_c := True
  34.                 retry
  35.             end
  36.         end
  37.  
  38. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top