aboutsummaryrefslogtreecommitdiff
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
parent522e51d46065cfe715694ba313a804bb7c83491a (diff)
downloadpaludis-218ea600dff25eee3cc6c0a97b12dc9aea3d7e4b.tar.gz
paludis-218ea600dff25eee3cc6c0a97b12dc9aea3d7e4b.tar.xz
Make use of OutputManager::nothing_more_to_come()
-rw-r--r--paludis/file_output_manager.cc31
-rw-r--r--paludis/forward_on_failure_output_manager.cc5
-rw-r--r--src/clients/cave/cmd_sync.cc2
3 files changed, 26 insertions, 12 deletions
diff --git a/paludis/file_output_manager.cc b/paludis/file_output_manager.cc
index f7a7f44..e0b9423 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 d1b527c..52028c9 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> >
diff --git a/src/clients/cave/cmd_sync.cc b/src/clients/cave/cmd_sync.cc
index b32ddcf..939232f 100644
--- a/src/clients/cave/cmd_sync.cc
+++ b/src/clients/cave/cmd_sync.cc
@@ -258,6 +258,8 @@ namespace
throw SyncFailedError("Sync aborted by hook");
}
+ output_manager->nothing_more_to_come();
+
if (skipped)
cout << format_general_spad(f::sync_repo_done_no_syncing_required(), stringify(name),
executor->pending(), executor->active(), executor->done());