3

I saw this command in SO How to filter the xcodebuild command line output?

which shows only the errors and warnings when we do xcodebuild otherwise the xcodebuild commands prints everything to the console regarding what it is doing.

Is there a way I can use grep with xcodebuild in an ant task ?

 <exec executable="xcodebuild" failonerror="true">
                <arg value="| grep error" />
                <arg value="clean" />
                <arg value="build" />
  </exec> 

The exec task above throws error while trying to execute the ant task.

Community
  • 1
  • 1
Nav
  • 10,304
  • 20
  • 56
  • 83

2 Answers2

5

-quiet do not print any output except for warnings and errors

xcodebuild clean build -quiet

it works.

Languoguang
  • 2,166
  • 2
  • 10
  • 15
2

This question might be helpful. I also suppose you need to invoke actions first and then grep. Maybe this will work:

<exec dir="${projectPath}/" executable="bash" failonerror="true">
   <arg value="-c"/>
   <arg value="xcodebuild clean build | grep error"/>
</exec>
Community
  • 1
  • 1
Opal
  • 81,889
  • 28
  • 189
  • 210