Re: How To Run Terminal.app from Xcode
Re: How To Run Terminal.app from Xcode
- Subject: Re: How To Run Terminal.app from Xcode
- From: Andreas Grosam <email@hidden>
- Date: Thu, 03 Nov 2011 22:24:40 +0100
On Nov 3, 2011, at 9:20 PM, Jens Alfke wrote: On Nov 3, 2011, at 8:51 AM, Andreas Grosam wrote: export DYLD_FRAMEWORK_PATH=/Users/path/to/library cd ${BUILT_PRODUCTS_DIR} open -a Terminal.app AllTests This above also fails when launched from within Terminal. It seems, the environment variables will not be inherited.
The OS doesn’t launch a new app as a child process of the process that launched it, rather as a child process of launchd. So apps won’t inherit environment variables this way.
You could tell Terminal to run a shell script, pass the desired framework path as a parameter to the script, and then set the environment variable in the script, with something like export DYLD_FRAMEWORK_PATH=“$1” ./AllTests
—Jens
Yes, this is probably the way to go - except that I don't know how to pass that parameter to a script that must be a file and is executed by Terminal.app: open -a Terminal.app <script_file>
In the meantime I got this to work:
In Xcode's Post-action I put this script:
tmpFile=${CONFIGURATION_TEMP_DIR}/run_test_script.sh echo "#!/bin/bash" > ${tmpFile} echo "cd ${BUILT_PRODUCTS_DIR}" >> ${tmpFile} echo "./AllTests" >> ${tmpFile} chmod +x ${tmpFile} open -a Terminal.app ${tmpFile}
This works like expected, but is a bit elaborated.
Andreas |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden