Skip to content

Commit

Permalink
fix bug causing vim to switch to an empty buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
toothbrush committed Oct 22, 2011
1 parent 842fad6 commit 265313c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions xcodebuild-wrapper.sh
Expand Up @@ -12,30 +12,32 @@
IPHONESIM=iphonesim

project_file=$1
echo "Building $project_file..."
echo "Building $project_file..." >&2
commandline="xcodebuild -project $project_file -configuration Debug -sdk iphonesimulator "
echo "The command will be:"
echo "$commandline"
echo "The command will be:" >&2
echo "$commandline" >&2
buildresult=`$commandline 2>&1`
resultcode=$?
if [ $resultcode -ne 0 ]; then
echo "Build failed."
echo "Build output:"
echo "$buildresult"
echo "Build failed." >&2
echo "Build output:" >&2
echo "$buildresult" >&2
exit
fi

executable=`echo "$buildresult" | grep Touch | awk ' { print $NF } '`
echo "This produced the executable:"
echo $executable
echo "This produced the executable:" >&2
echo $executable >&2

# find latest sdk

latest=`$IPHONESIM showsdks 2>&1 | grep "(.\..)" | sed "s/.*(\(.\..\))$/\1/" | tail -n 1`
echo "Latest SDK version seems to be $latest."
echo "Latest SDK version seems to be $latest." >&2

$IPHONESIM launch $executable $latest ipad &
# Find the directory where this script sits:
DIR="$( cd -P "$( dirname "$0" )" && pwd )"
# ...and run the applescript.
osascript $DIR/focusSimulator.applescript
# The ugly construction here is so osascript doesn't produce any output. This
# otherwise causes vim to switch to an empty buffer after completion.
echo $( osascript $DIR/focusSimulator.applescript 2>&1 1> /dev/null ) > /dev/null

0 comments on commit 265313c

Please sign in to comment.