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

后端 未结 3 495
渐次进展
渐次进展 2021-02-09 08:52

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 osas

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-09 09:27

    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

提交回复
热议问题