Skip to content

fix(remote): harden iTerm2 window select + remote uid probe (follow-up to #201)#202

Merged
wxtsky merged 1 commit into
mainfrom
fix/iterm-select-guard
May 30, 2026
Merged

fix(remote): harden iTerm2 window select + remote uid probe (follow-up to #201)#202
wxtsky merged 1 commit into
mainfrom
fix/iterm-select-guard

Conversation

@wxtsky
Copy link
Copy Markdown
Owner

@wxtsky wxtsky commented May 30, 2026

Self-review follow-up on #201.

1. iTerm2 select <window> could abort the jump

#201 added select <window> to raise the matched window on fullscreen / cross-Space jumps. iTerm2 does support select on a window, but if it ever throws (window mid-transition, etc.) the surrounding try would swallow it and skip the select tab / select session that follow — i.e. the jump would do nothing, worse than before #201. Each select <window> is now wrapped in its own try on all three match paths (session-id / tty / cwd).

2. Remote uid probe used a non-POSIX pipeline

The probe ran uid=$(id -u ...); rm -f ...; printf .... SSH runs remote commands under the user's login shell, so on a fish/csh login shell the $(...) form fails and we silently fall back to the shared socket path (defeating #193 for those users). Replaced with a bare id -u, which behaves identically under any shell. Also removed the redundant stale-socket cleanup (the forward's StreamLocalBindUnlink=yes already handles it), so a host that's failing to connect no longer eats a second SSH round-trip.

3. Removed the now-unused shellSingleQuoted helper.

swift test — 341 passing.

🤖 Generated with Claude Code

Follow-up hardening on #201:
- Guard each iTerm2 `select <window>` with its own `try` so an unexpected failure
  (e.g. a window mid fullscreen-transition) can't abort the surrounding script and
  skip the tab/session select — that would have made the jump worse than before.
- Probe the remote uid with a bare `id -u` instead of a `$(...)` pipeline so it
  runs identically under non-POSIX login shells (fish/csh) instead of silently
  falling back to the shared socket path. Also drops the redundant cleanup
  round-trip (StreamLocalBindUnlink already clears stale sockets on bind), so a
  failing host no longer waits on a second SSH.
- Remove the now-unused shellSingleQuoted helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wxtsky wxtsky merged commit 2fad1b1 into main May 30, 2026
@wxtsky wxtsky deleted the fix/iterm-select-guard branch May 30, 2026 02:02
GeorgeDong32 pushed a commit to GeorgeDong32/CodeIsland that referenced this pull request May 31, 2026
…#202)

Follow-up hardening on wxtsky#201:
- Guard each iTerm2 `select <window>` with its own `try` so an unexpected failure
  (e.g. a window mid fullscreen-transition) can't abort the surrounding script and
  skip the tab/session select — that would have made the jump worse than before.
- Probe the remote uid with a bare `id -u` instead of a `$(...)` pipeline so it
  runs identically under non-POSIX login shells (fish/csh) instead of silently
  falling back to the shared socket path. Also drops the redundant cleanup
  round-trip (StreamLocalBindUnlink already clears stale sockets on bind), so a
  failing host no longer waits on a second SSH.
- Remove the now-unused shellSingleQuoted helper.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant