summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmCTest.cxx8
-rw-r--r--Source/cmSystemTools.cxx4
-rw-r--r--Source/kwsys/Process.h.in13
-rw-r--r--Source/kwsys/ProcessUNIX.c10
-rw-r--r--Source/kwsys/ProcessWin32.c12
-rw-r--r--Source/kwsys/test1.cxx4
-rw-r--r--Source/kwsys/testProcess.c4
7 files changed, 18 insertions, 37 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 0274e27..50a2692 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2363,9 +2363,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output,
std::cout << " Each . represents " << tick_len << " bytes of output" << std::endl;
std::cout << " " << std::flush;
}
- while(cmsysProcess_WaitForData(cp, (cmsysProcess_Pipe_STDOUT |
- cmsysProcess_Pipe_STDERR),
- &data, &length, 0))
+ while(cmsysProcess_WaitForData(cp, &data, &length, 0))
{
if ( output )
{
@@ -2454,9 +2452,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, int *re
char* data;
int length;
- while(cmsysProcess_WaitForData(cp, (cmsysProcess_Pipe_STDOUT |
- cmsysProcess_Pipe_STDERR),
- &data, &length, 0))
+ while(cmsysProcess_WaitForData(cp, &data, &length, 0))
{
if ( output )
{
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 341348d..8d1640d 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -403,9 +403,7 @@ bool cmSystemTools::RunSingleCommand(
std::vector<char> tempOutput;
char* data;
int length;
- while(cmsysProcess_WaitForData(cp, (cmsysProcess_Pipe_STDOUT |
- cmsysProcess_Pipe_STDERR),
- &data, &length, 0))
+ while(cmsysProcess_WaitForData(cp, &data, &length, 0))
{
if ( output )
{
diff --git a/Source/kwsys/Process.h.in b/Source/kwsys/Process.h.in
index 16ccddd..0583c0c 100644
--- a/Source/kwsys/Process.h.in
+++ b/Source/kwsys/Process.h.in
@@ -213,13 +213,9 @@ kwsysEXPORT const char* kwsysProcess_GetErrorString(kwsysProcess* cp);
kwsysEXPORT void kwsysProcess_Execute(kwsysProcess* cp);
/**
- * Block until data are available on a requested pipe, a timeout
- * expires, or the child process terminates. Arguments are as
- * follows:
+ * Block until data are available on a pipe, a timeout expires, or the
+ * child process terminates. Arguments are as follows:
*
- * pipes = Flags for the child output pipes of interest to the caller.
- * Possible values are Pipe_STDOUT and Pipe_STDERR. Multiple
- * pipes may be specified by using the bitwise OR operator '|'.
* data = If data are read, the pointer to which this points is
* set to point to the data.
* length = If data are read, the integer to which this points is
@@ -241,9 +237,8 @@ kwsysEXPORT void kwsysProcess_Execute(kwsysProcess* cp);
* call. Time elapsed has been subtracted from timeout
* argument.
*/
-kwsysEXPORT int kwsysProcess_WaitForData(kwsysProcess* cp, int pipes,
- char** data, int* length,
- double* timeout);
+kwsysEXPORT int kwsysProcess_WaitForData(kwsysProcess* cp, char** data,
+ int* length, double* timeout);
enum kwsysProcess_Pipes_e
{
kwsysProcess_Pipe_STDOUT=1,
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index 5efd0b9..7e8c617 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -486,8 +486,8 @@ void kwsysProcess_Execute(kwsysProcess* cp)
}
/*--------------------------------------------------------------------------*/
-int kwsysProcess_WaitForData(kwsysProcess* cp, int pipes, char** data,
- int* length, double* userTimeout)
+int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
+ double* userTimeout)
{
int i;
int max = -1;
@@ -537,9 +537,9 @@ int kwsysProcess_WaitForData(kwsysProcess* cp, int pipes, char** data,
{
/* This is data on the special termination pipe. Ignore it. */
}
- else if(pipes & (1 << i))
+ else if(data && length)
{
- /* Caller wants this data. Report it. */
+ /* Report this data. */
*data = cp->PipeBuffer;
*length = n;
pipeId = (1 << i);
@@ -687,7 +687,7 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
}
/* Wait for all the pipes to close. Ignore all data. */
- while((pipe = kwsysProcess_WaitForData(cp, 0, 0, 0, userTimeout)) > 0)
+ while((pipe = kwsysProcess_WaitForData(cp, 0, 0, userTimeout)) > 0)
{
if(pipe == kwsysProcess_Pipe_Timeout)
{
diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c
index 7317cf7..fd4ddd0 100644
--- a/Source/kwsys/ProcessWin32.c
+++ b/Source/kwsys/ProcessWin32.c
@@ -921,7 +921,7 @@ void kwsysProcess_Execute(kwsysProcess* cp)
/*--------------------------------------------------------------------------*/
-int kwsysProcess_WaitForData(kwsysProcess* cp, int pipes, char** data, int* length,
+int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
double* userTimeout)
{
kwsysProcessTime userStartTime;
@@ -997,18 +997,14 @@ int kwsysProcess_WaitForData(kwsysProcess* cp, int pipes, char** data, int* leng
/* The pipe closed. */
--cp->PipesLeft;
}
- else if(pipes & (1 << cp->CurrentIndex))
+ else if(data && length)
{
- /* Caller wants this data. Report it. */
+ /* Report this data. */
*data = cp->Pipe[cp->CurrentIndex].DataBuffer;
*length = cp->Pipe[cp->CurrentIndex].DataLength;
pipeId = (1 << cp->CurrentIndex);
done = 1;
}
- else
- {
- /* Caller does not care about this pipe. Ignore the data. */
- }
}
else
{
@@ -1074,7 +1070,7 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
}
/* Wait for the process to terminate. Ignore all data. */
- while((pipe = kwsysProcess_WaitForData(cp, 0, 0, 0, userTimeout)) > 0)
+ while((pipe = kwsysProcess_WaitForData(cp, 0, 0, userTimeout)) > 0)
{
if(pipe == kwsysProcess_Pipe_Timeout)
{
diff --git a/Source/kwsys/test1.cxx b/Source/kwsys/test1.cxx
index 7dd61a4..84c3f8d 100644
--- a/Source/kwsys/test1.cxx
+++ b/Source/kwsys/test1.cxx
@@ -11,9 +11,7 @@ int main()
kwsysProcess_Execute(kp);
char* data = 0;
int length = 0;
- while(kwsysProcess_WaitForData(kp, (kwsysProcess_Pipe_STDOUT |
- kwsysProcess_Pipe_STDERR),
- &data, &length, 0))
+ while(kwsysProcess_WaitForData(kp, &data, &length, 0))
{
kwsys_std::cout.write(data, length);
}
diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c
index c569528..1b4ea74 100644
--- a/Source/kwsys/testProcess.c
+++ b/Source/kwsys/testProcess.c
@@ -66,9 +66,7 @@ int runChild(const char* cmd[], int state, int exception, int value)
kwsysProcess_SetTimeout(kp, 3);
kwsysProcess_Execute(kp);
- while(kwsysProcess_WaitForData(kp, (kwsysProcess_Pipe_STDOUT |
- kwsysProcess_Pipe_STDERR),
- &data, &length, 0))
+ while(kwsysProcess_WaitForData(kp, &data, &length, 0))
{
fwrite(data, 1, length, stdout);
fflush(stdout);