Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ at one version, so a release has a section in each changelog.
and when loading requires that directory to exist. (#164)
- Contributors can install the same tmux releases locally with
`libtmux/mise-tmux` that Linux CI selects with `libtmux/setup-tmux`. (#168)
- The Linux pane fixture waits for tmux to record a process exit after its
control stream closes. (#195)
- The MCP slow-reader test identifies whether the transport write expired or
its test observer timed out. (#175)
- The repository retired `scripts/build-tmux` and `scripts/apt-get.sh` when
Expand Down
3 changes: 2 additions & 1 deletion test/integration/mcp_cursor_identity_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def test_reaped_leader_with_draining_output_rejects_reused_pid_and_foreign_ident
assert_equal "ready\n", sink.gets
connection.puts("write-and-exit")
assert_equal "", connection.read
status = scope.server.run(["display-message", "-p", "-t", pane.id, '#{pane_dead}|#{pane_dead_status}|#{pane_dead_signal}']).text
# The control stream can close before tmux records the exit.
status = fixture.wait_for_pane_exit_status(scope.server, pane.id)
assert_equal "0|0|\n", status, "the leader is reaped while its output pipe still has queued bytes"
klass = LibTmux::MCP.const_get(:ProcessIdentity)
original = klass.method(:acquire)
Expand Down
20 changes: 20 additions & 0 deletions test/support/tmux_fixture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,26 @@ def tmux(*arguments)
capture(*arguments)
end

def wait_for_pane_exit_status(server, pane_id, timeout: 5.0)
deadline = monotonic + timeout
status = nil
loop do
remaining = deadline - monotonic
return status unless remaining.positive?

status = server.run(["display-message", "-p", "-t", pane_id,
'#{pane_dead}|#{pane_dead_status}|#{pane_dead_signal}'], timeout: remaining).text
return status unless status == "0||\n"

pause = [deadline - monotonic, 0.02].min
sleep pause if pause.positive?
end
rescue LibTmux::DeadlineExceeded
raise if status.nil?

status
end

def close
failure = nil
begin
Expand Down
Loading