# HG changeset patch # User Carnë Draug # Date 1424807242 0 # Node ID f81a1da191e4c220c5b30c3691f547882c365bc7 # Parent 1c9ed5b4c73d95d0ba017e4bc02cb828205e219a Script file or eval code are not interactive session so keep Octave quiet. * libinterp/octave.cc: add a new static variable an_octave_program to keep track when this is called for an Octave program and not for an Octave interactive session. The main point of this patch is so that octave_startup_message() on octave_execute_interpreter() is not called. A continuation work from csets 6ba5f1ff041e and f3ac54ac2c6a which also aimed at doing this. The idea is to have an_octave_program inherit other features of a non-interactive session (such as being canceled by forcing an interactive session or not starting readline). diff -r 1c9ed5b4c73d -r f81a1da191e4 libinterp/octave.cc --- a/libinterp/octave.cc Tue Feb 24 17:09:42 2015 +0000 +++ b/libinterp/octave.cc Tue Feb 24 19:47:22 2015 +0000 @@ -172,6 +172,11 @@ // (--traditional) static bool traditional = false; +// TRUE if this is a program and no interpreter and interaction is +// needed. For example, an octave program with shebang line, or code +// from eval without persist. +static bool an_octave_program = false; + // Store the command-line options for later use. static void @@ -703,13 +708,14 @@ } bool script_file = (argc - optind) > 0; - if (! code_to_eval.empty () && script_file) { error ("--eval \"CODE\" and script file are mutually exclusive options"); octave_print_terse_usage_and_exit (); } + an_octave_program = (script_file || ! code_to_eval.empty ()) && ! persist; + } // EMBEDDED is declared int instead of bool because this function is @@ -788,7 +794,7 @@ // a redirected file. bool stdin_is_tty = gnulib::isatty (fileno (stdin)); - interactive = (! embedded && stdin_is_tty + interactive = (! embedded && ! an_octave_program && stdin_is_tty && gnulib::isatty (fileno (stdout))); // Check if the user forced an interactive session. If he