Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

v0.44.0 - Context managers

Compare
Choose a tag to compare
Loading
@tony tony released this 16 Feb 22:24
· 156 commits to master since this release

What's Changed

Support for context managers

by @tony in #566.

Added context manager support for all main tmux objects:

  • Server: Automatically kills the server when exiting the context
  • Session: Automatically kills the session when exiting the context
  • Window: Automatically kills the window when exiting the context
  • Pane: Automatically kills the pane when exiting the context

Example usage:

with Server() as server:
    with server.new_session() as session:
        with session.new_window() as window:
            with window.split() as pane:
                pane.send_keys('echo "Hello"')
                # Do work with the pane
                # Everything is cleaned up automatically when exiting contexts

This makes it easier to write clean, safe code that properly cleans up tmux resources.

Full Changelog: v0.43.0...v0.44.0

Morty Proxy This is a proxified and sanitized view of the page, visit original site.