MCPcopy Create free account
hub / github.com/boostorg/build / read_pipe

Function read_pipe

src/engine/execnt.c:704–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

702
703
704static void read_pipe
705(
706 HANDLE in, /* the pipe to read from */
707 string * out
708)
709{
710 DWORD bytesInBuffer = 0;
711 DWORD bytesAvailable = 0;
712
713 do
714 {
715 /* check if we have any data to read */
716 if ( !PeekNamedPipe( in, ioBuffer, IO_BUFFER_SIZE, &bytesInBuffer,
717 &bytesAvailable, NULL ) )
718 bytesAvailable = 0;
719
720 /* read in the available data */
721 if ( bytesAvailable > 0 )
722 {
723 /* we only read in the available bytes, to avoid blocking */
724 if ( ReadFile( in, ioBuffer, bytesAvailable <= IO_BUFFER_SIZE ?
725 bytesAvailable : IO_BUFFER_SIZE, &bytesInBuffer, NULL ) )
726 {
727 if ( bytesInBuffer > 0 )
728 {
729 /* Clean up some illegal chars. */
730 int i;
731 for ( i = 0; i < bytesInBuffer; ++i )
732 {
733 if ( ( (unsigned char)ioBuffer[ i ] < 1 ) )
734 ioBuffer[ i ] = '?';
735 }
736 /* Null, terminate. */
737 ioBuffer[ bytesInBuffer ] = '\0';
738 /* Append to the output. */
739 string_append( out, ioBuffer );
740 /* Subtract what we read in. */
741 bytesAvailable -= bytesInBuffer;
742 }
743 else
744 {
745 /* Likely read a error, bail out. */
746 bytesAvailable = 0;
747 }
748 }
749 else
750 {
751 /* Definitely read a error, bail out. */
752 bytesAvailable = 0;
753 }
754 }
755 }
756 while ( bytesAvailable > 0 );
757}
758
759
760static void read_output()

Callers 1

read_outputFunction · 0.85

Calls 1

string_appendFunction · 0.85

Tested by

no test coverage detected