我尝试在lint脚本中造成致命错误。目前,我能够创建一个正常的错误,使我可以编译代码。 有什么办法可以在此脚本中创建致命错误?
if which swiftlint >/dev/null; then
swiftlint
else
echo "error: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
答案 0 :(得分:1)
如果生成脚本以非零退出状态终止,则Xcode生成过程将失败并显示错误:
if which swiftlint >/dev/null; then
swiftlint
else
echo "error: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
exit 1
fi
或者只使用
swiftlint
作为构建脚本。如果未找到swiftlint程序,则构建过程也将失败,并显示类似
的错误消息swiftlint: command not found Command /bin/sh failed with exit code 127