diff --git a/step.go b/step.go index e2d181ff..e9477608 100644 --- a/step.go +++ b/step.go @@ -23,8 +23,6 @@ const timeOutMessageIPhoneSimulator = "iPhoneSimulator: Timed out waiting" // with Xcode Command Line `xcodebuild`. const timeOutMessageUITest = "Terminating app due to uncaught exception '_XCTestCaseInterruptionException'" -const xcodeVersionPrefix = "Xcode " - func exportEnvironmentWithEnvman(keyStr, valueStr string) error { log.Printf("Exporting: %s", keyStr) envman := exec.Command("envman", "add", "--key", keyStr) @@ -35,18 +33,14 @@ func exportEnvironmentWithEnvman(keyStr, valueStr string) error { } func getXcodeVersion() (string, error) { - outBuffer := bytes.Buffer{} - errBuffer := bytes.Buffer{} cmd := exec.Command("xcodebuild", "-version") - cmd.Stdout = io.Writer(&outBuffer) - cmd.Stderr = io.Writer(&errBuffer) - - if err := cmd.Run(); err != nil { - return "", fmt.Errorf("xcodebuild -version failed, err: %s, details: %s", err, errBuffer.String()) + outBytes, err := cmd.CombinedOutput() + if err != nil { + return "", fmt.Errorf("xcodebuild -version failed, err: %s, details: %s", err, string(outBytes)) } - return outBuffer.String(), nil + return string(outBytes), nil } func printConfig(projectPath, scheme, simulatorDevice, simulatorOsVersion, action, deviceDestination string, cleanBuild bool) {