Applescript control over iTerm2 became sluggish in 3.1beta4
I'm on 10.12.4. When I switched from 3.1beta3 to 3.1beta4, I noticed that my applescript for spawning new iterms in the current directory has suddenly become painfully slow. That goes away immediately upon reverting to 3.1beta3.
Here is the applescript (embedded in bash for easier calling from shell scripts, but that's not the problem):
#!/bin/bash
# This is called with an argument that's either "Terminal" or "iTerm2".
# I've cut out the code for launching Terminal.app windows.
osa () {
osascript << HERE
tell app "System Events" to (name of every process) contains "$1"
HERE
}
myd=$(osascript -e \
'tell app "Finder" to POSIX path of (insertion location as alias)')
fi
if [[ $(osa iTerm2) == "true" ]] ; then
osascript <<-AAAAA
tell application "iTerm"
activate
set myterm to (create window with default profile)
tell (current session of myterm) to write text "cd \"$myd\""
end tell
AAAAA
else
osascript <<-AAAAA
tell app "iTerm"
activate
tell (current session of window 1) to write text "cd \"$myd\""
end tell
AAAAA
fi
Prior to 3.1beta4, this script was snappy. The only lag was a tiny one when iTerm wasn't already an open application. But with 3.1beta4, it sometimes takes 5 seconds (!) for a new iTerm window to appear.
Did something about the applescript support change?