diff src/octave.cc @ 7202:ffdbdf53665c

[project @ 2007-11-27 20:14:41 by jwe]
author jwe
date Tue, 27 Nov 2007 20:16:19 +0000 (2007-11-27)
parents a1dbe9d80eee
children 745a8299c2b5 e76649d19a1a
line wrap: on
line diff
--- a/src/octave.cc
+++ b/src/octave.cc
@@ -366,6 +366,18 @@
 {
   unwind_protect::begin_frame ("execute_eval_option_code");
 
+  octave_save_signal_mask ();
+
+  can_interrupt = true;
+
+  octave_signal_hook = octave_signal_handler;
+  octave_interrupt_hook = unwind_protect::run_all;
+  octave_bad_alloc_hook = unwind_protect::run_all;
+
+  octave_catch_interrupts ();
+
+  octave_initialized = true;
+
   unwind_protect_bool (interactive);
 
   interactive = false;
@@ -376,6 +388,11 @@
     {
       eval_string (code, false, parse_status, 0);
     }
+  catch (octave_interrupt_exception)
+    {
+      recover_from_exception ();
+      octave_stdout << "\n";
+    }
   catch (std::bad_alloc)
     {
       std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- eval failed"
@@ -392,6 +409,18 @@
 {
   unwind_protect::begin_frame ("execute_command_line_file");
 
+  octave_save_signal_mask ();
+
+  can_interrupt = true;
+
+  octave_signal_hook = octave_signal_handler;
+  octave_interrupt_hook = unwind_protect::run_all;
+  octave_bad_alloc_hook = unwind_protect::run_all;
+
+  octave_catch_interrupts ();
+
+  octave_initialized = true;
+
   unwind_protect_bool (interactive);
   unwind_protect_bool (reading_script_file);
   unwind_protect_bool (input_from_command_line_file);
@@ -422,6 +451,11 @@
     {
       parse_and_execute (fname, false, "octave");
     }
+  catch (octave_interrupt_exception)
+    {
+      recover_from_exception ();
+      octave_stdout << "\n";
+    }
   catch (std::bad_alloc)
     {
       std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- execution of "