aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-15 00:37:26 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-15 00:37:26 +0000
commita597404b65591b2edfce4428713f6ccd184b582f (patch)
treee1af07fe8a2f835b86ac91e9b950079743fd3bd6
parentcd0aba72c7ec8e12841272f4d54d6fd02c9f8b16 (diff)
downloadpaludis-a597404b65591b2edfce4428713f6ccd184b582f.tar.gz
paludis-a597404b65591b2edfce4428713f6ccd184b582f.tar.xz
Fix output wrapper stderr prefix. Make output wrapper work for PStream too.
-rw-r--r--paludis/util/output_wrapper.cc2
-rw-r--r--paludis/util/pstream.cc12
2 files changed, 10 insertions, 4 deletions
diff --git a/paludis/util/output_wrapper.cc b/paludis/util/output_wrapper.cc
index b9cfef9..9ea5889 100644
--- a/paludis/util/output_wrapper.cc
+++ b/paludis/util/output_wrapper.cc
@@ -187,7 +187,7 @@ main(int argc, char *argv[])
if (! stderr_prefix_shown)
{
if (stderr_had_interesting_char)
- std::cerr << stdout_prefix;
+ std::cerr << stderr_prefix;
stderr_prefix_shown = true;
}
diff --git a/paludis/util/pstream.cc b/paludis/util/pstream.cc
index 9000542..23c2f58 100644
--- a/paludis/util/pstream.cc
+++ b/paludis/util/pstream.cc
@@ -124,11 +124,17 @@ PStreamInBuf::PStreamInBuf(const Command & cmd) :
extras.append(" [setuid " + stringify(*cmd.uid()) + "]");
}
+ std::string c(cmd.command());
+
+ if ((! cmd.stdout_prefix().empty()) || (! cmd.stderr_prefix().empty()))
+ c = LIBEXECDIR "/paludis/utils/outputwrapper --stdout-prefix '"
+ + cmd.stdout_prefix() + "' --stderr-prefix '" + cmd.stderr_prefix() + "' -- " + c;
+
cmd.echo_to_stderr();
- Log::get_instance()->message(ll_debug, lc_no_context, "execl /bin/sh -c " + cmd.command()
+ Log::get_instance()->message(ll_debug, lc_no_context, "execl /bin/sh -c " + c
+ " " + extras);
- execl("/bin/sh", "sh", "-c", cmd.command().c_str(), static_cast<char *>(0));
- throw PStreamError("execl /bin/sh -c '" + cmd.command() + "' failed:"
+ execl("/bin/sh", "sh", "-c", c.c_str(), static_cast<char *>(0));
+ throw PStreamError("execl /bin/sh -c '" + c + "' failed:"
+ stringify(strerror(errno)));
}
else if (-1 == child)