[Orxonox-commit 1299] r6017 - code/branches/console/src/libraries/core

rgrieder at orxonox.net rgrieder at orxonox.net
Mon Nov 2 23:42:16 CET 2009


Author: rgrieder
Date: 2009-11-02 23:42:16 +0100 (Mon, 02 Nov 2009)
New Revision: 6017

Modified:
   code/branches/console/src/libraries/core/Shell.cc
Log:
Fix in Shell: No string in outputLines_ should contain '\n'.

Modified: code/branches/console/src/libraries/core/Shell.cc
===================================================================
--- code/branches/console/src/libraries/core/Shell.cc	2009-11-02 17:06:25 UTC (rev 6016)
+++ code/branches/console/src/libraries/core/Shell.cc	2009-11-02 22:42:16 UTC (rev 6017)
@@ -30,6 +30,7 @@
 
 #include "util/OutputHandler.h"
 #include "util/StringUtils.h"
+#include "util/SubString.h"
 #include "CommandExecutor.h"
 #include "CoreIncludes.h"
 #include "ConfigValueIncludes.h"
@@ -191,9 +192,14 @@
 
     void Shell::addOutputLine(const std::string& line, int level)
     {
-        if (level <= this->softDebugLevel_)
-            this->outputLines_.push_front(line);
-        this->updateListeners<&ShellListener::lineAdded>();
+        // Make sure we really only have one line per line (no new lines!)
+        SubString lines(line, '\n');
+        for (unsigned i = 0; i < lines.size(); ++i)
+        {
+            if (level <= this->softDebugLevel_)
+                this->outputLines_.push_front(lines[i]);
+            this->updateListeners<&ShellListener::lineAdded>();
+        }
     }
 
     void Shell::clearOutput()




More information about the Orxonox-commit mailing list