[paludis-commits] r4112 - trunk/paludis/util

ciaranm at svn.pioto.org ciaranm at svn.pioto.org
Sun Dec 30 23:17:23 UTC 2007


Author: ciaranm
Date: 2007-12-30 23:17:22 +0000 (Sun, 30 Dec 2007)
New Revision: 4112

Modified:
   trunk/paludis/util/system.cc
Log:
Fixx0r


Modified: trunk/paludis/util/system.cc
===================================================================
--- trunk/paludis/util/system.cc	2007-12-30 22:56:39 UTC (rev 4111)
+++ trunk/paludis/util/system.cc	2007-12-30 23:17:22 UTC (rev 4112)
@@ -533,6 +533,19 @@
             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 @@
                     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())



More information about the paludis-commits mailing list