AppleScript can write text to a wrong iTerm session if the initial one got killed and another one was already opened
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: 3.0.12
- OS version: El Capitan
Sorry it's not performance issue or hang or whatever like that. It's a bit complex to explain and understand but basically our goal was to be able to open an iTerm window with 16 split session per tab getting the macro to open connection on each session in parallel.
We did achieve something closer to that but by doing that we realised a strange bug.
If we start writing to a session but this session got killed during the process, instead of just failing to write the next content to the session the text will just go to another iTerm opened session.......
What we do is that we prepare all the session with one AppleScript in the way described above and we pass the Session IDs to another script which has the goal of running our macro in parallel, one per session.
AppleScript Session Opener => Talking to one Window ID | ˇ Python Script Macro Launcher | | | | ˇ ˇ ˇ ˇ One AppleScript instance per Session ID => Looping through all Window/Tab to catch a matching Session ID => When found use the Tell window > Tell tab > Tell session, to write to and read from for the entire life time of the Macro.
Then if the initial Window ID is lost because I close the window before the Macro is completed for all Session then I usually will get the eventual written to another Session ID of another Window ID.
Any way to prevent that from happening?
Thanks for your help.