Skip to content
Snippets Groups Projects
Commit 5b96222b authored by Brad King's avatar Brad King
Browse files

ENH: Error messages from the forwarding executable are now read completely...

ENH: Error messages from the forwarding executable are now read completely even if they are reported in multiple blocks.
parent fe2e561f
No related branches found
No related tags found
No related merge requests found
...@@ -1434,10 +1434,21 @@ int kwsysProcessCreate(kwsysProcess* cp, int index, STARTUPINFO* si, ...@@ -1434,10 +1434,21 @@ int kwsysProcessCreate(kwsysProcess* cp, int index, STARTUPINFO* si,
{ {
/* Wait for the forwarding executable to report an error or /* Wait for the forwarding executable to report an error or
close the error pipe to report success. */ close the error pipe to report success. */
DWORD nRead = 0; DWORD total = 0;
if(ReadFile(errorReadEnd, cp->ErrorMessage, DWORD n = 1;
KWSYSPE_PIPE_BUFFER_SIZE, &nRead, 0) || while(total < KWSYSPE_PIPE_BUFFER_SIZE && n > 0)
GetLastError() != ERROR_BROKEN_PIPE) {
if(ReadFile(errorReadEnd, cp->ErrorMessage+total,
KWSYSPE_PIPE_BUFFER_SIZE-total, &n, 0))
{
total += n;
}
else
{
n = 0;
}
}
if(total > 0 || GetLastError() != ERROR_BROKEN_PIPE)
{ {
/* The forwarding executable could not run the process, or /* The forwarding executable could not run the process, or
there was an error reading from its error pipe. Preserve there was an error reading from its error pipe. Preserve
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment