Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode build phases: run script in background (without blocking build)

Tags:

xcode

I'd like to be able to run a script in the background (i.e. without blocking the build process) when I build and run an iOS application in the simulator. I've tried osascript /path/to/script &, and also backgrounding a separate shell script that does the same, but neither have worked; the build stops and I have to force quit XCode.

Any ideas?

like image 561
Joshua Conner Avatar asked Apr 16 '13 03:04

Joshua Conner


1 Answers

I had the same trouble with running a background script as part of the build phase but the following does work in my case. The script runs in the background while my app runs. Apparently, you have to redirect the standard output in addition to using the "&". Use the following format. (My script is located in directory '~/Desktop/splint_server/')

~/Desktop/splint_server/run.sh > ~/Desktop/splint_server/test 2>&1 &

This runs an arbitrary script at ~/Desktop/splint_server/run.sh (put the path to your script there). The output is redirected to a log file called "test".

More information about I/O redirection http://www.tldp.org/LDP/abs/html/io-redirection.html

like image 182
Bill Avatar answered Sep 25 '22 06:09

Bill