2

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?

YogevSitton
  • 10,068
  • 11
  • 62
  • 95

2 Answers2

0

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.

Jeff
  • 3,829
  • 1
  • 31
  • 49
0

Try out

  • running your script separately
  • check the permission

    Additional info:

  • xcodeserver is running on the context of the user _xcsbuildd, if you are running the script using relative paths of a regular user, that could pose problems
  • Kukzee
    • 1