Transaction¶
Provides a class to facilitate atomic transactions.
- class Transaction(connection: iterm2.connection.Connection)¶
An asyncio context manager for transactions.
A transaction is a sequence of API calls that occur without anything else happening in between. If you’re worried about state mutating between reading the screen contents and then sending text, for example, do it in a transaction and you’ll know the state of the terminal will remain unchanged during it.
Some APIs are noted as not being allowed during a transaction. These do not complete synchronously and would therefore deadlock in a transaction.
- Parameters
connection – The connection to iTerm2.
- Example
- async with iterm2.Transaction():
do stuff