changeset 15990:696e82182eba

Check if history edition was successful, abort operation on failure.
author Júlio Hoffimann <julio.hoffimann@gmail.com>
date Wed, 30 Jan 2013 17:02:21 -0300
parents 47a4c92924a7
children 9cb64bafa7bd
files libinterp/interpfcn/oct-hist.cc
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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.