Mercurial > hg > octave-nkf
comparison src/octave.cc @ 14564:a459d42bb0a6
Return an error exit code to shell when eval'ed code fails a memory allocation.
octave.cc (execute_eval_option_code, safe_source_file): Set error_state variable
to -2 when bad_alloc exception encountered.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 14 Apr 2012 19:33:45 -0700 |
parents | c67822beb7a4 |
children | 4e9dc46d4125 |
comparison
equal
deleted
inserted
replaced
14563:c973d4637659 | 14564:a459d42bb0a6 |
---|---|
315 gripe_safe_source_exception (file_name, "unhandled execution exception"); | 315 gripe_safe_source_exception (file_name, "unhandled execution exception"); |
316 } | 316 } |
317 catch (std::bad_alloc) | 317 catch (std::bad_alloc) |
318 { | 318 { |
319 recover_from_exception (); | 319 recover_from_exception (); |
320 error_state = -2; | |
320 gripe_safe_source_exception | 321 gripe_safe_source_exception |
321 (file_name, | 322 (file_name, |
322 "memory exhausted or requested size too large for range of Octave's index type"); | 323 "memory exhausted or requested size too large for range of Octave's index type"); |
323 } | 324 } |
324 } | 325 } |
441 std::cerr << "error: unhandled execution exception -- eval failed" | 442 std::cerr << "error: unhandled execution exception -- eval failed" |
442 << std::endl; | 443 << std::endl; |
443 } | 444 } |
444 catch (std::bad_alloc) | 445 catch (std::bad_alloc) |
445 { | 446 { |
447 error_state = -2; | |
446 std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- eval failed" | 448 std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- eval failed" |
447 << std::endl; | 449 << std::endl; |
448 } | 450 } |
449 | 451 |
450 return parse_status; | 452 return parse_status; |