错误 xcodebuild NSFileHandle 无法写入。异常:*** -[_NSStdIOFileHandle writeData:]:生成 Apollo GraphQL API 时管道损坏

jan*_*hau 7 xcode xcodebuild graphql apollo-ios cicd

救命啊!我只是想让我的管道成功运行TT任何人都可以帮助我~

情况:我正在将 Apollo 客户端集成到我的 iOS 项目中,并遵循 Apollo 官方提供的说明 - https://www.apollographql.com/docs/ios/installation(使用 SPM 方式设置)。在 Xcode 手动编译和测试中,它对我来说一切正常。然而,当我使用命令运行单元测试时,我在生成 Apollo GraphQL API 时遇到了困难。以下是我在运行时收到的错误 xcodebuild test -scheme ${CI_PROJECT_NAME} -project ${CI_PROJECT_NAME}.xcodeproj -destination "${XCODE_APPLICATION_PLATFORM}" -enableCodeCoverage YES| xcpretty -s

错误: xcodebuild[10347:2192409] NSFileHandle couldn't write. Exception: *** -[_NSStdIOFileHandle writeData:]: Broken pipe

注意:当我在 Gitlab 管道中通过命令行运行单元测试时,会发生此错误。使用 Xcode 13.2.1。

在此输入图像描述

小智 1

我在网上找到这篇文章:https://peterthomashorn.info/blog/broken-pipe-in ​​-gitlab-with-xcpretty/

建议将LC_ALLgitlab CI 中的环境变量设置为en_US.UTF-8. 我相信这将字符编码设置为 UTF-8,这样 xcpretty 就不会因通过管道传输到其中的字节而阻塞。