aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-01-05 15:39:57 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-01-05 18:42:52 +0000
commit218ea600dff25eee3cc6c0a97b12dc9aea3d7e4b (patch)
treee68d1c82d5aacf2a960704ede7f21e4630ca4448 /paludis
parent522e51d46065cfe715694ba313a804bb7c83491a (diff)
downloadpaludis-218ea600dff25eee3cc6c0a97b12dc9aea3d7e4b.tar.gz
paludis-218ea600dff25eee3cc6c0a97b12dc9aea3d7e4b.tar.xz
Make use of OutputManager::nothing_more_to_come()
Diffstat (limited to 'paludis')
-rw-r--r--paludis/file_output_manager.cc31
-rw-r--r--paludis/forward_on_failure_output_manager.cc5
2 files changed, 24 insertions, 12 deletions
diff --git a/paludis/file_output_manager.cc b/paludis/file_output_manager.cc
index f7a7f44c2..e0b9423cd 100644
--- a/paludis/file_output_manager.cc
+++ b/paludis/file_output_manager.cc
@@ -73,18 +73,7 @@ FileOutputManager::FileOutputManager(const FSEntry & o, const bool k, const bool
FileOutputManager::~FileOutputManager()
{
- if (! _imp->keep_on_empty)
- {
- *_imp->stdout_stream << std::flush;
- *_imp->stderr_stream << std::flush;
-
- FSEntry filename_now(stringify(_imp->filename));
- if (filename_now.exists() && 0 == filename_now.file_size())
- {
- filename_now.unlink();
- _imp->unlinked = true;
- }
- }
+ nothing_more_to_come();
if (_imp->summary_output_manager)
{
@@ -137,6 +126,24 @@ FileOutputManager::want_to_flush() const
void
FileOutputManager::nothing_more_to_come()
{
+ if (! _imp->stdout_stream)
+ return;
+
+ *_imp->stdout_stream << std::flush;
+ _imp->stdout_stream.reset();
+
+ *_imp->stderr_stream << std::flush;
+ _imp->stderr_stream.reset();
+
+ if (! _imp->keep_on_empty)
+ {
+ FSEntry filename_now(stringify(_imp->filename));
+ if (filename_now.exists() && 0 == filename_now.file_size())
+ {
+ filename_now.unlink();
+ _imp->unlinked = true;
+ }
+ }
}
const std::tr1::shared_ptr<const Set<std::string> >
diff --git a/paludis/forward_on_failure_output_manager.cc b/paludis/forward_on_failure_output_manager.cc
index d1b527cb8..52028c925 100644
--- a/paludis/forward_on_failure_output_manager.cc
+++ b/paludis/forward_on_failure_output_manager.cc
@@ -104,6 +104,11 @@ ForwardOnFailureOutputManager::want_to_flush() const
void
ForwardOnFailureOutputManager::nothing_more_to_come()
{
+ if (_imp->success)
+ {
+ _imp->stdout_stream.clear();
+ _imp->stderr_stream.clear();
+ }
}
const std::tr1::shared_ptr<const Set<std::string> >