# HG changeset patch # User JĂșlio Hoffimann # Date 1359576141 10800 # Node ID 696e82182eba3a647916c5c7b299b674657d148f # Parent 47a4c92924a70ae18d2481dc62b52b41b922b6f3 Check if history edition was successful, abort operation on failure. diff -r 47a4c92924a7 -r 696e82182eba libinterp/interpfcn/oct-hist.cc --- a/libinterp/interpfcn/oct-hist.cc Tue Jan 29 18:24:16 2013 +0100 +++ b/libinterp/interpfcn/oct-hist.cc Wed Jan 30 17:02:21 2013 -0300 @@ -496,10 +496,18 @@ volatile octave_interrupt_handler old_interrupt_handler = octave_ignore_interrupts (); - system (cmd.c_str ()); + int status = system (cmd.c_str ()); octave_set_interrupt_handler (old_interrupt_handler); + // Check if text edition was successfull. Abort the operation + // in case of failure. + if (status != EXIT_SUCCESS) + { + error ("edit_history: text editor command failed"); + return; + } + // Write the commands to the history file since source_file // disables command line history while it executes.