Terminal: "do script" can execute commands in the wrong order

Originator:jediknil
Number:rdar://FB7599057 Date Originated:2020-02-25
Status:Open Resolved:
Product:Terminal Product Version:macOS Catalina 10.15.3 (19D76)
Classification:Incorrect/Unexpected Behavior Reproducible:
 
The following AppleScript consistently prints “second” before “first” when run from Script Editor (with Terminal already open) if .bash_profile or equivalent takes a long time. (For testing purposes, add `sleep 5` to your .bash_profile.)

tell application "Terminal"
	set newTab to do script "echo first"
	do script "echo second" in newTab
end tell

Workaround:

tell application "Terminal"
	set newTab to do script
	do script "echo first" in newTab
	do script "echo second" in newTab
end tell

Running macOS Catalina 10.15.3 (19D76).

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!