summaryrefslogtreecommitdiffstats
path: root/Source/cmakexbuild.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-03-31 18:17:23 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-03-31 18:17:23 (GMT)
commitae10b3578d3234db1e379b663657fbdb9d1ac543 (patch)
tree39fd57f7548112c5bb1d3501c9a80fb686911bbf /Source/cmakexbuild.cxx
parentbc649db7cc51acbd56c145fd884a49f049c8393f (diff)
downloadCMake-ae10b3578d3234db1e379b663657fbdb9d1ac543.zip
CMake-ae10b3578d3234db1e379b663657fbdb9d1ac543.tar.gz
CMake-ae10b3578d3234db1e379b663657fbdb9d1ac543.tar.bz2
ENH: add a wrapper for xcodebuild to get around bug and verbose output
Diffstat (limited to 'Source/cmakexbuild.cxx')
-rw-r--r--Source/cmakexbuild.cxx25
1 files changed, 16 insertions, 9 deletions
diff --git a/Source/cmakexbuild.cxx b/Source/cmakexbuild.cxx
index b0728aa..6bf4da4 100644
--- a/Source/cmakexbuild.cxx
+++ b/Source/cmakexbuild.cxx
@@ -1,6 +1,13 @@
#include <cmsys/Process.h>
#include "cmStandardIncludes.h"
+// This is a wrapper program for xcodebuild
+// it calls xcodebuild, and does two things
+// it removes much of the output, all the setevn
+// stuff. Also, it checks for the text file busy
+// error, and re-runs xcodebuild until that error does
+// not show up.
+
int WaitForLine(cmsysProcess* process, std::string& line,
double timeout,
std::vector<char>& out,
@@ -113,29 +120,31 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
std::vector<char> out;
std::vector<char> err;
std::string line;
- int pipe =WaitForLine(cp, line, 0, out, err);
+ int pipe =WaitForLine(cp, line, 100.0, out, err);
while(pipe != cmsysProcess_Pipe_None)
{
if(line.find("/bin/sh: bad interpreter: Text file busy")
!= line.npos)
{
hitbug = true;
- std::cerr << "Found xcodebuild bug: " << line << "\n";
+ std::cerr << "Hit xcodebuild bug : " << line << "\n";
}
// if the bug is hit, no more output should be generated
// because it may contain bogus errors
- if(!hitbug)
+ // also remove all output with setenv in it to tone down
+ // the verbosity of xcodebuild
+ if(!hitbug && (line.find("setenv") == line.npos))
{
if(pipe == cmsysProcess_Pipe_STDERR)
{
- std::cerr << line;
+ std::cerr << line << "\n";
}
else if(pipe == cmsysProcess_Pipe_STDOUT)
{
- std::cout << line;
+ std::cout << line << "\n";
}
- pipe =WaitForLine(cp, line, 0, out, err);
}
+ pipe =WaitForLine(cp, line, 100, out, err);
}
cmsysProcess_WaitForExit(cp, 0);
if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exited)
@@ -144,7 +153,6 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
}
if(cmsysProcess_GetState(cp) == cmsysProcess_State_Error)
{
- std::cerr << "error\n";
return -1;
}
return -1;
@@ -160,12 +168,11 @@ int main(int ac, char*av[])
}
argv.push_back(0);
bool hitbug = true;
- int ret;
+ int ret = 0;
while(hitbug)
{
ret = RunXCode(argv, hitbug);
}
- std::cerr << "ret " << ret << "\n";
if(ret < 0)
{
return 255;