# HG changeset patch # User Rik # Date 1334457225 25200 # Node ID a459d42bb0a61d791538a02d9582e8df7bda6158 # Parent c973d4637659aec8bafc5a7fc10b992597e4412c 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. diff --git a/src/octave.cc b/src/octave.cc --- a/src/octave.cc +++ b/src/octave.cc @@ -317,6 +317,7 @@ catch (std::bad_alloc) { recover_from_exception (); + error_state = -2; gripe_safe_source_exception (file_name, "memory exhausted or requested size too large for range of Octave's index type"); @@ -443,6 +444,7 @@ } catch (std::bad_alloc) { + error_state = -2; std::cerr << "error: memory exhausted or requested size too large for range of Octave's index type -- eval failed" << std::endl; }