Xcode Server Fails When Running Shell Scripts

advertisements

I'm having an issue where my bots on the Xcode server are failing when trying to run my project's shell script: Shell Script Invocation Error: Command /bin/sh failed with exit code 252

How can I fix this? Should I prevent the Xcode server from running shell scripts? If so - how can I do that?


I don't think Xcode server is failing to run the script.

That error means to me that Xcode server is running the script and the last command to run in the shell is failing with exit code 252 and the shell is passing that exit code on to the Xcode server. So you need to figure out what command in the shell script is not happy when run on the Xcode Server.

Add debug logging to the shell. Almost all shell commands should be written as:

if rm -rf ${somedir:?}; then
    echo "Deleting $somedir OK."
else
    echo "Error deleting $somedir."
fi

Instead of just:

rm -rf ${somedir:?}
cd ..
# And so on.

Then, you can look at the shell script output in the Xcode Server Bot logs and have a better hint at what the problem is.