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

Function read_pipe

src/engine/execnt.cpp:772–811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

770#define FORWARD_PIPE_STDERR 2
771
772static void read_pipe
773(
774 HANDLE in, /* the pipe to read from */
775 string * out,
776 int32_t forwarding_mode
777)
778{
779 DWORD bytesInBuffer = 0;
780 DWORD bytesAvailable = 0;
781 DWORD i;
782
783 for (;;)
784 {
785 /* check if we have any data to read */
786 if ( !PeekNamedPipe( in, NULL, IO_BUFFER_SIZE, NULL,
787 &bytesAvailable, NULL ) || bytesAvailable == 0 )
788 return;
789
790 /* we only read in the available bytes, to avoid blocking */
791 if ( !ReadFile( in, ioBuffer, bytesAvailable <= IO_BUFFER_SIZE ?
792 bytesAvailable : IO_BUFFER_SIZE, &bytesInBuffer, NULL ) || bytesInBuffer == 0 )
793 return;
794
795 /* Clean up some illegal chars. */
796 for ( i = 0; i < bytesInBuffer; ++i )
797 {
798 if ( ( (unsigned char)ioBuffer[ i ] < 1 ) )
799 ioBuffer[ i ] = '?';
800 }
801 /* Null, terminate. */
802 ioBuffer[ bytesInBuffer ] = '\0';
803 /* Append to the output. */
804 string_append( out, ioBuffer );
805 /* Copy it to our output if appropriate */
806 if ( forwarding_mode == FORWARD_PIPE_STDOUT )
807 out_data( ioBuffer );
808 else if ( forwarding_mode == FORWARD_PIPE_STDERR )
809 err_data( ioBuffer );
810 }
811}
812
813#define EARLY_OUTPUT( cmd ) \
814 ( ! ( cmd.flags & EXEC_CMD_QUIET ) )

Callers 1

read_outputFunction · 0.85

Calls 3

string_appendFunction · 0.85
out_dataFunction · 0.85
err_dataFunction · 0.85

Tested by

no test coverage detected