changeset 22184:a032ffb80704

don't print startup message for --eval (bug #48620) * interpreter.cc (interpreter::interpreter): Don't attempt to modify command line options. (interpreter::execute): Avoid printing startup message if session is not interactive.
author John W. Eaton <jwe@octave.org>
date Tue, 26 Jul 2016 09:49:56 -0400
parents bfb1b089c230
children dc20b737ee79
files libinterp/corefcn/interpreter.cc
diffstat 1 files changed, 8 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Mon Jul 25 14:50:29 2016 +0100
+++ b/libinterp/corefcn/interpreter.cc	Tue Jul 26 09:49:56 2016 -0400
@@ -616,32 +616,23 @@
                      && stdin_is_tty
                      && octave_isatty_wrapper (fileno (stdout)));
 
-    // Check if the user forced an interactive session.  If he
-    // unnecessarily did so, reset forced_interactive to false.
+    // Check if the user forced an interactive session.
     if (options.forced_interactive ())
-      {
-        if (m_interactive)
-          options.forced_interactive (false);
-        else
-          m_interactive = true;
-      }
+      m_interactive = true;
 
+    bool line_editing = options.line_editing ();
     if ((! m_interactive || options.forced_interactive ())
         && ! options.forced_line_editing ())
-      options.line_editing (false);
-
-    // Also skip start-up message unless session is interactive.
-    if (! m_interactive)
-      options.inhibit_startup_message (true);
+      line_editing = false;
 
     // Force default line editor if we don't want readline editing.
-    if (! options.line_editing ())
+    if (line_editing)
       octave::command_editor::force_default_editor ();
 
     // These can come after command line args since none of them set any
     // defaults that might be changed by command line options.
 
-    if (options.line_editing ())
+    if (line_editing )
       initialize_command_input ();
 
     octave_interpreter_ready = true;
@@ -662,7 +653,7 @@
   {
     cmdline_options options = m_app_context->options ();
 
-    if (! options.inhibit_startup_message ())
+    if (m_interactive && ! options.inhibit_startup_message ())
       std::cout << octave_startup_message () << "\n" << std::endl;
 
     octave_prepare_hdf5 ();
@@ -672,7 +663,7 @@
                            options.verbose_flag (),
                            options.inhibit_startup_message ());
 
-    if (! options.inhibit_startup_message ()
+    if (m_interactive && ! options.inhibit_startup_message ()
         && reading_startup_message_printed)
       std::cout << std::endl;