[nemiver/console] Avoid too many printing of the prompt



commit bc9250ffd71623805e5a021db7d7203101e2cf7f
Author: Fabien Parent <parent f gmail com>
Date:   Fri Mar 2 19:54:15 2012 +0100

    Avoid too many printing of the prompt

 src/common/nmv-console.cc |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/common/nmv-console.cc b/src/common/nmv-console.cc
index ae17645..80ad2aa 100644
--- a/src/common/nmv-console.cc
+++ b/src/common/nmv-console.cc
@@ -106,11 +106,13 @@ struct Console::Priv {
     Glib::RefPtr<Glib::IOSource> io_source;
     sigc::connection cmd_execution_done_connection;
     sigc::connection cmd_execution_timeout_connection;
+    bool done_signal_received;
 
     Priv (int a_fd) :
         fd (a_fd),
         stream (a_fd),
-        io_source (Glib::IOSource::create (a_fd, Glib::IO_IN))
+        io_source (Glib::IOSource::create (a_fd, Glib::IO_IN)),
+        done_signal_received (false)
     {
         init ();
     }
@@ -319,6 +321,7 @@ struct Console::Priv {
         }
 
         Command &command = commands.at (command_name);
+        done_signal_received = false;
         cmd_execution_done_connection = command.done_signal ().connect
             (sigc::mem_fun (*this, &Console::Priv::on_done_signal));
         commands.at (command_name) (cmd_argv, stream);
@@ -344,6 +347,11 @@ struct Console::Priv {
     {
         NEMIVER_TRY
 
+        if (done_signal_received) {
+            return;
+        }
+
+        done_signal_received = true;
         stream << CONSOLE_PROMPT;
         cmd_execution_timeout_connection.disconnect();
         cmd_execution_done_connection.disconnect ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]