comparison 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
comparison
equal deleted inserted replaced
20742:5e2da9a66510 20743:b6408331bfa2
855 std::cout << std::endl; 855 std::cout << std::endl;
856 856
857 // Execute any code specified with --eval 'CODE' 857 // Execute any code specified with --eval 'CODE'
858 if (! code_to_eval.empty ()) 858 if (! code_to_eval.empty ())
859 { 859 {
860 int parse_status = execute_eval_option_code (code_to_eval); 860 int parse_status = 0;
861
862 try
863 {
864 parse_status = execute_eval_option_code (code_to_eval);
865 }
866 catch (const octave_execution_exception&)
867 {
868 parse_status = 1;
869 }
861 870
862 if (! persist) 871 if (! persist)
863 { 872 {
864 quitting_gracefully = true; 873 quitting_gracefully = true;
865 874
866 clean_up_and_exit (parse_status || error_state ? 1 : 0); 875 clean_up_and_exit (parse_status);
867 } 876 }
868 } 877 }
869 878
870 // If there is an extra argument, see if it names a file to read. 879 // If there is an extra argument, see if it names a file to read.
871 // Additional arguments are taken as command line options for the script. 880 // Additional arguments are taken as command line options for the script.
876 if (remaining_args > 0) 885 if (remaining_args > 0)
877 { 886 {
878 // If we are running an executable script (#! /bin/octave) then 887 // If we are running an executable script (#! /bin/octave) then
879 // we should only see the args passed to the script. 888 // we should only see the args passed to the script.
880 889
881 intern_argv (remaining_args, octave_cmdline_argv+last_arg_idx); 890 int exit_status = 0;
882 891
883 execute_command_line_file (octave_cmdline_argv[last_arg_idx]); 892 try
893 {
894 intern_argv (remaining_args, octave_cmdline_argv+last_arg_idx);
895
896 execute_command_line_file (octave_cmdline_argv[last_arg_idx]);
897 }
898 catch (const octave_execution_exception&)
899 {
900 exit_status = 1;
901 }
884 902
885 if (! persist) 903 if (! persist)
886 { 904 {
887 quitting_gracefully = true; 905 quitting_gracefully = true;
888 906
889 clean_up_and_exit (error_state ? 1 : 0); 907 clean_up_and_exit (exit_status);
890 } 908 }
891 } 909 }
892 910
893 // Avoid counting commands executed from startup files. 911 // Avoid counting commands executed from startup files.
894 912