BUG: get the correct return value from pclose
This commit is contained in:
parent
17b6c98c19
commit
2b9140f6b5
|
@ -27,6 +27,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
|
@ -1019,6 +1020,8 @@ bool cmSystemTools::RunCommand(const char* command,
|
||||||
{
|
{
|
||||||
std::cout << "running " << command << std::endl;
|
std::cout << "running " << command << std::endl;
|
||||||
}
|
}
|
||||||
|
fflush(stdout);
|
||||||
|
fflush(stderr);
|
||||||
FILE* cpipe = popen(command, "r");
|
FILE* cpipe = popen(command, "r");
|
||||||
if(!cpipe)
|
if(!cpipe)
|
||||||
{
|
{
|
||||||
|
@ -1034,7 +1037,10 @@ bool cmSystemTools::RunCommand(const char* command,
|
||||||
output += buffer;
|
output += buffer;
|
||||||
fgets(buffer, BUFFER_SIZE, cpipe);
|
fgets(buffer, BUFFER_SIZE, cpipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
retVal = pclose(cpipe);
|
retVal = pclose(cpipe);
|
||||||
|
retVal = WEXITSTATUS(retVal);
|
||||||
|
std::cout << "*** cmSystemTools: return value from " << command << " is "<< retVal << "\n";
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue