aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-12 12:39:21 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-12 18:26:26 +0100
commite60c58deb05398a2539ef630521f7f7880315891 (patch)
tree75a5f4b52d92f5c1e897432a1fddc98193e3f8f8
parentaa5c9550d2b94d153fb9999f9ca27269ab635bde (diff)
downloadpaludis-e60c58deb05398a2539ef630521f7f7880315891.tar.gz
paludis-e60c58deb05398a2539ef630521f7f7880315891.tar.xz
Use OutputManager
-rw-r--r--paludis/hooker.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/paludis/hooker.cc b/paludis/hooker.cc
index 2aa6fbd..3311a71 100644
--- a/paludis/hooker.cc
+++ b/paludis/hooker.cc
@@ -38,6 +38,7 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/singleton-impl.hh>
#include <paludis/about.hh>
+#include <paludis/output_manager.hh>
#include <list>
#include <iterator>
#include <dlfcn.h>
@@ -156,7 +157,7 @@ namespace
HookResult
BashHookFile::run(
const Hook & hook,
- const std::shared_ptr<OutputManager> &) const
+ const std::shared_ptr<OutputManager> & optional_output_manager) const
{
Context c("When running hook script '" + stringify(file_name()) + "' for hook '" + hook.name() + "':");
@@ -181,6 +182,13 @@ BashHookFile::run(
for (Hook::ConstIterator x(hook.begin()), x_end(hook.end()) ; x != x_end ; ++x)
cmd.with_setenv(x->first, x->second);
+ if (optional_output_manager)
+ {
+ /* hod_grab can override this later */
+ cmd.with_captured_stdout_stream(&optional_output_manager->stdout_stream());
+ cmd.with_captured_stderr_stream(&optional_output_manager->stderr_stream());
+ }
+
int exit_status(0);
std::string output("");
if (hook.output_dest == hod_grab)
@@ -208,7 +216,7 @@ BashHookFile::run(
HookResult
FancyHookFile::run(const Hook & hook,
- const std::shared_ptr<OutputManager> &) const
+ const std::shared_ptr<OutputManager> & optional_output_manager) const
{
Context c("When running hook script '" + stringify(file_name()) + "' for hook '" + hook.name() + "':");
@@ -236,6 +244,13 @@ FancyHookFile::run(const Hook & hook,
for (Hook::ConstIterator x(hook.begin()), x_end(hook.end()) ; x != x_end ; ++x)
cmd.with_setenv(x->first, x->second);
+ if (optional_output_manager)
+ {
+ /* hod_grab can override this later */
+ cmd.with_captured_stdout_stream(&optional_output_manager->stdout_stream());
+ cmd.with_captured_stderr_stream(&optional_output_manager->stderr_stream());
+ }
+
int exit_status(0);
std::string output("");
if (hook.output_dest == hod_grab)