Skip to content

Commit

Permalink
distinguish standard output and error
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Nov 14, 2012
1 parent e50b2d2 commit 647b7bc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cpp/session/modules/build/SessionSourceCpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ class SourceCppContext : boost::noncopyable
// collect all build output
std::string buildOutput;
if (!succeeded || showOutput_)
buildOutput = consoleOutputBuffer_;
buildOutput = consoleOutputBuffer_ + consoleErrorBuffer_;
else
buildOutput = output + consoleOutputBuffer_;
buildOutput = output + consoleErrorBuffer_;

// reset state
reset();
Expand All @@ -113,14 +113,18 @@ class SourceCppContext : boost::noncopyable
void onConsoleOutput(module_context::ConsoleOutputType type,
const std::string& output)
{
consoleOutputBuffer_.append(output);
if (type == module_context::ConsoleOutputNormal)
consoleOutputBuffer_.append(output);
else
consoleErrorBuffer_.append(output);
}

void reset()
{
sourceFile_ = FilePath();
showOutput_ = false;
consoleOutputBuffer_.clear();
consoleErrorBuffer_.clear();
module_context::events().onConsoleOutput.disconnect(
boost::bind(&SourceCppContext::onConsoleOutput, this, _1, _2));
previousPath_.clear();
Expand All @@ -131,6 +135,7 @@ class SourceCppContext : boost::noncopyable
FilePath sourceFile_;
bool showOutput_;
std::string consoleOutputBuffer_;
std::string consoleErrorBuffer_;
std::string previousPath_;
std::string rToolsWarning_;
};
Expand Down

0 comments on commit 647b7bc

Please sign in to comment.