comparison libinterp/interpfcn/oct-hist.cc @ 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 bc7a130bbdfb
children 9194bb707d63
comparison
equal deleted inserted replaced
15987:47a4c92924a7 15990:696e82182eba
494 // maybe avoid using system()? 494 // maybe avoid using system()?
495 495
496 volatile octave_interrupt_handler old_interrupt_handler 496 volatile octave_interrupt_handler old_interrupt_handler
497 = octave_ignore_interrupts (); 497 = octave_ignore_interrupts ();
498 498
499 system (cmd.c_str ()); 499 int status = system (cmd.c_str ());
500 500
501 octave_set_interrupt_handler (old_interrupt_handler); 501 octave_set_interrupt_handler (old_interrupt_handler);
502
503 // Check if text edition was successfull. Abort the operation
504 // in case of failure.
505 if (status != EXIT_SUCCESS)
506 {
507 error ("edit_history: text editor command failed");
508 return;
509 }
502 510
503 // Write the commands to the history file since source_file 511 // Write the commands to the history file since source_file
504 // disables command line history while it executes. 512 // disables command line history while it executes.
505 513
506 std::fstream file (name.c_str (), std::ios::in); 514 std::fstream file (name.c_str (), std::ios::in);