Skip to content

Commit

Permalink
More.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Jul 9, 2019
1 parent cf3704c commit 55f738b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions pdal/util/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,14 @@ namespace Utils
*/
inline void restore(std::ostream& out, RedirectStream& redir)
{
// The buffer must be restored prior to potentially deleting
// the source or things could blow up.
out.rdbuf(redir.m_buf);
if (redir.m_out)
{
redir.m_out->close();
delete redir.m_out;
}
redir.m_out = NULL;
redir.m_buf = NULL;
}
Expand Down
12 changes: 6 additions & 6 deletions test/unit/filters/MergeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ TEST(MergeTest, test6)
mgr.setLog(log);
mgr.readPipeline(Support::configuredpath("filters/merge3.json"));

std::ostringstream oss;
auto ctx = Utils::redirect(std::clog, oss);
std::cerr << "Before execute!\n";
mgr.execute();
std::cerr << "After execute!\n";
{
std::ostringstream oss;
auto ctx = Utils::redirect(std::clog, oss);
mgr.execute();
Utils::restore(std::clog, ctx);
}

/**
Utils::restore(std::clog, ctx);
std::string s = oss.str();
EXPECT_TRUE(s.find("inconsistent spatial references") != s.npos);
Expand Down

0 comments on commit 55f738b

Please sign in to comment.