Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
xcodebuild和bash命令响应_Xcode_Bash_Command Line_Xcodebuild - Fatal编程技术网

xcodebuild和bash命令响应

xcodebuild和bash命令响应,xcode,bash,command-line,xcodebuild,Xcode,Bash,Command Line,Xcodebuild,我使用xcodebuild从构建服务器上的脚本构建我的应用程序。当构建实际失败时,构建服务器报告成功,因此我正在尝试改进脚本 我遇到一些问题的地方是从xcodebuild命令中获取错误和警告 例如,我通过删除磁盘上的一些图像而不是项目文件来伪造错误。如果我运行xcodebuild,我会在最后得到以下输出: ** BUILD FAILED ** The following build commands failed: CopyPNGFile build/Release-iphoneos/TT.a

我使用xcodebuild从构建服务器上的脚本构建我的应用程序。当构建实际失败时,构建服务器报告成功,因此我正在尝试改进脚本

我遇到一些问题的地方是从xcodebuild命令中获取错误和警告

例如,我通过删除磁盘上的一些图像而不是项目文件来伪造错误。如果我运行xcodebuild,我会在最后得到以下输出:

** BUILD FAILED **

The following build commands failed:
CopyPNGFile build/Release-iphoneos/TT.app/settingscreen.png Resources/Images/helpscreens/settingscreen.png
CopyPNGFile build/Release-iphoneos/TT.app/settingscreen.png Resources/Images/helpscreens/settingscreen.png
(2 failures)
因此,我假设可以从输出中grep“BUILD FAILED”。但没有这样的运气。我将遵循以下思路:

OUTPUT=`${XCODEBUILD} -target "$TARGET" -configuration "$CONFIGURATION"`
ANY_FAILURES=`echo "$OUTPUT" | grep -c "BUILD FAILED"`

if [ "$ANY_FAILURES" -gt "0" ]; then
   #...code here if failure...
fi
但它没有。如果我尝试构建并输出到/dev/null,就像这样

/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -target TT -configuration Release > /dev/null
然后我仍然看到:

** BUILD FAILED **

The following build commands failed:
CopyPNGFile build/Release-iphoneos/TT.app/settingscreen.png Resources/Images/helpscreens/settingscreen.png
CopyPNGFile build/Release-iphoneos/TT.app/settingscreen.png Resources/Images/helpscreens/settingscreen.png
(2 failures)
因此,我似乎无法获得输出的这段文本的引用

我该怎么做


谢谢

可能的MSG副本,如“构建失败”,通常会发送给stderr。在cmd中尝试…-configuration$configuration 2>&1。祝你好运,非常好。因此,2>&1将stderr与stdout相结合。很好的一个,成功了。把这个移到一个答案上来,让自己得到一些分数。