GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `here` mode: `send_keys` for env vars and shell replacement diverges from teamocil and is unsafe · Issue #1030 · tmux-python/tmuxp

here mode: send_keys for env vars and shell replacement diverges from teamocil and is unsafe #1030

New issue
Copy link
New issue
Copy link
Open
0 / 20 of 2 issues completed
Open
here mode: send_keys for env vars and shell replacement diverges from teamocil and is unsafe#1030
0 / 20 of 2 issues completed
Copy link

Description

@tony
tony
opened on Mar 29, 2026
Issue body actions

Problem

--here mode in tmuxp uses send_keys to inject infrastructure commands (cd, export, shell replacement) into the active pane. This has three failure modes:

  1. export is not POSIX-universal — it's a syntax error in fish, nu, and other non-bash/zsh shells
  2. Types into foreground programs — if the active pane is running vim, python, htop, etc., the cd/export commands are typed as input, corrupting the user's session
  3. Shell history pollution — cd and export commands appear in the user's shell history

What tmuxp does (3 categories of send_keys)

builder.py:695-727:

# 1. Directory change via send_keys
active_pane.send_keys(f"cd {shlex.quote(start_directory)}", enter=True)

# 2. Environment vars via send_keys (N calls, one per var)
_here_pane.send_keys(f"export {_ekey}={shlex.quote(str(_eval))}", enter=True)

# 3. Shell replacement via send_keys
_here_pane.send_keys(window_shell, enter=True)

What teamocil does (1 category of send_keys)

teamocil's --here only uses send_keys for cd — the one unavoidable case. Everything else uses tmux primitives:

  • Window rename: rename-window — tmux command, not send_keys
  • Directory (cd): send_keys cd "/path" — only send_keys usage
  • Pane splitting: split-window -c '/path' — tmux primitive with -c for directory
  • Environment vars: Not handled at all — no send_keys export
  • Shell replacement: Not handled — teamocil doesn't change the running shell

tmuxinator similarly never uses send_keys for infrastructure — only for user-specified pane commands. Directories use -c on new-window and splitw.

Impact

Categories 2 and 3 (export and window_shell) are tmuxp-specific — neither Ruby tool does this. They are the primary source of the POSIX shell assumption and the "types into vim" failure mode.

Proposed solutions

Two approaches, tracked as sub-issues:

  • Level 1 (here mode level 1: match teamocil — use set_environment + respawn-pane, keep send_keys cd only #1031): Match teamocil — use session.set_environment() for env vars, respawn-pane for shell replacement, keep send_keys cd only
  • Level 2 (here mode level 2: eliminate send_keys entirely — split-window/swap-pane/kill-pane #1032): Eliminate send_keys entirely — use split-window/swap-pane/kill-pane to create a fresh pane with correct dir+env

References

  • teamocil --here implementation: window.rb:67-95
  • teamocil pane splitting with -c: split_window.rb
  • teamocil --here tests: window_spec.rb:110-145
  • tmuxinator window creation (no send_keys for infra): window.rb:120-123
  • tmuxinator pane creation with -c: pane.rb:53-58

Activity

  1. tony
    added sub-issues on Mar 29, 2026
    • here mode level 1: match teamocil — use set_environment + respawn-pane, keep send_keys cd only #1031
    • here mode level 2: eliminate send_keys entirely — split-window/swap-pane/kill-pane #1032
  2. tony
    changed the title [-]here mode: send_keys for env vars and shell replacement diverges from teamocil and is unsafe[/-] [+]`here` mode: `send_keys` for env vars and shell replacement diverges from teamocil and is unsafe[/+] on Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.