`xcodebuild build test` hangs indefinitely when piped to another command

Originator:michael.furtak
Number:rdar://27595098 Date Originated:28-Jul-2016
Status:Duplicate/26872644 Resolved:
Product:Developer Tools Product Version:Xcode 8 beta 3
Classification: Reproducible:Always
 
Possibly a duplicate of rdar://26872644

Summary:
The version of xcodebuild distributed with Xcode 8 beta 3 exhibits a hanging behavior if its output is piped to another command while running a `build test` command.

This was not a problem with xcodebuild distributed with Xcode 7.3.

Steps to Reproduce:
Using Xcode 8 beta 3

The happy path:

1. Create a new iOS Single View project in Swift, including Unit Tests and UI Tests. In my example, I've called it "Whatever"
2. On the command line, navigate to the directory where Whatever.xcodeproj is located.
3. Run: `xcodebuild -scheme Whatever -project ./Whatever.xcodeproj -destination 'platform=iOS Simulator,id=<SIMULATOR_ID>' build test` substituting a simulator ID for your system
4. Find that the simulator is launched, the tests run, the command exits, and control returns to the terminal

The sad path (starting in-place from step 3):

3. Run: `xcodebuild -scheme Whatever -project ./Whatever.xcodeproj -destination 'platform=iOS Simulator,id=<SIMULATOR_ID>' build test | grep 'SUCCEEDED'` substituting a simulator ID for your system
4. Find that a simulator is launched, the tests run, but the command never exits, and control does not return to the terminal.
5. Quit the Simulator app, and find that the command exits and control returns to the terminal.


Expected Results:
I expect to be able to pipe the output of `xcodebuild build test` to another command without causing it to hang.

Actual Results:
The example command hangs in the terminal after printing "** TEST SUCCEEDED **", never returning control to the terminal. Quitting the spawned Simulator.app allows the command to exit.

Version:
OS X El Capitan 10.11.6
Xcode 8 beta 3

Notes:


Configuration:
OS X El Capitan 10.11.6
Xcode 8 beta 3
Running in Terminal.app

Attachments:

Comments

Fixed as of Xcode 8 beta 4

This problem appears to be fixed as of Xcode 8 beta 4

By michael.furtak at Aug. 2, 2016, 1:57 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!