diff libinterp/octave.cc @ 20743:b6408331bfa2

eliminate more uses of error_state * graphics.cc, input.cc, max.cc, rand.cc, __eigs__.cc, ov-class.cc, ov-classdef.cc, ov.cc, octave.cc: Eliminate more uses of error_state.
author John W. Eaton <jwe@octave.org>
date Mon, 23 Nov 2015 23:23:57 -0500
parents b70cc4bd8109
children ee2743bd07a8
line wrap: on
line diff
--- a/libinterp/octave.cc	Mon Nov 23 21:00:14 2015 -0500
+++ b/libinterp/octave.cc	Mon Nov 23 23:23:57 2015 -0500
@@ -857,13 +857,22 @@
   // Execute any code specified with --eval 'CODE'
   if (! code_to_eval.empty ())
     {
-      int parse_status = execute_eval_option_code (code_to_eval);
+      int parse_status = 0;
+
+      try
+        {
+          parse_status = execute_eval_option_code (code_to_eval);
+        }
+      catch (const octave_execution_exception&)
+        {
+          parse_status = 1;
+        }
 
       if (! persist)
         {
           quitting_gracefully = true;
 
-          clean_up_and_exit (parse_status || error_state ? 1 : 0);
+          clean_up_and_exit (parse_status);
         }
     }
 
@@ -878,15 +887,24 @@
       // If we are running an executable script (#! /bin/octave) then
       // we should only see the args passed to the script.
 
-      intern_argv (remaining_args, octave_cmdline_argv+last_arg_idx);
+      int exit_status = 0;
+
+      try
+        {
+          intern_argv (remaining_args, octave_cmdline_argv+last_arg_idx);
 
-      execute_command_line_file (octave_cmdline_argv[last_arg_idx]);
+          execute_command_line_file (octave_cmdline_argv[last_arg_idx]);
+        }
+      catch (const octave_execution_exception&)
+        {
+          exit_status = 1;
+        }
 
       if (! persist)
         {
           quitting_gracefully = true;
 
-          clean_up_and_exit (error_state ? 1 : 0);
+          clean_up_and_exit (exit_status);
         }
     }