aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-12-30 23:17:22 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-12-30 23:17:22 +0000
commitbdfb39c717742af1eebd6e138fc1f06a78637b23 (patch)
tree0aebfce939841702e9add825bc25e731b9417f4d
parentef8e0303f241d54032883ab0c5aa1cb6e4b1996f (diff)
downloadpaludis-bdfb39c717742af1eebd6e138fc1f06a78637b23.tar.gz
paludis-bdfb39c717742af1eebd6e138fc1f06a78637b23.tar.xz
Fixx0r
-rw-r--r--paludis/util/system.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/paludis/util/system.cc b/paludis/util/system.cc
index 1fef385..8d0d87c 100644
--- a/paludis/util/system.cc
+++ b/paludis/util/system.cc
@@ -533,6 +533,19 @@ paludis::run_command(const Command & cmd)
else
{
char buf[1024];
+
+ if (cmd.captured_stdout_stream() && FD_ISSET(captured_stdout->read_fd(), &read_fds))
+ {
+ int r;
+ if (((r = read(captured_stdout->read_fd(), buf, 1024))) > 0)
+ {
+ *cmd.captured_stdout_stream() << std::string(buf, r);
+ /* don't look at the other FDs yet to avoid a partial read from being snipped
+ * when capturing output */
+ continue;
+ }
+ }
+
if (cmd.pipe_command_handler() && FD_ISSET(pipe_command_reader->read_fd(), &read_fds))
{
int r;
@@ -546,13 +559,6 @@ paludis::run_command(const Command & cmd)
if (((r = read(internal_command_reader->read_fd(), buf, 1024))) > 0)
internal_command_buffer.append(std::string(buf, r));
}
-
- if (cmd.captured_stdout_stream() && FD_ISSET(captured_stdout->read_fd(), &read_fds))
- {
- int r;
- if (((r = read(captured_stdout->read_fd(), buf, 1024))) > 0)
- *cmd.captured_stdout_stream() << std::string(buf, r);
- }
}
if (! pipe_command_buffer.empty())