fix Claude secondary pane copy + false "session exited"

Two things surfaced in the secondary pane: the tab said "session 1"
while the banner said "secondary 1" — now both say "session N". And the
banner showed "session exited" right after starting, even though Claude
was alive: a transient tmux client process can exit during spawn while
the session itself is fine. pane.exit now verifies via `tmux has-session`
and only reports exited when the session is actually gone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-23 09:48:26 +02:00
co-authored by Claude Opus 4.7
parent af483c2c34
commit f65ef50379
6 changed files with 34 additions and 2 deletions
@@ -104,6 +104,16 @@ void main() {
});
});
group('hasSession', () {
test('true on exit 0, false otherwise', () async {
runner.exitCode = 0;
expect(await tmux.hasSession('clide-claude-foo'), isTrue);
expect(runner.calls.last, ['-L', 'clide', 'has-session', '-t', 'clide-claude-foo']);
runner.exitCode = 1;
expect(await tmux.hasSession('clide-claude-foo'), isFalse);
});
});
group('sendMessage', () {
test('loads a bracketed paste buffer then submits with Enter', () async {
await tmux.sendMessage('clide-claude-foo', 'hello\nworld');