Skip to content

Commit c023026

Browse files
committed
docs(CHANGES): Scoping a Server no longer kills it
what: - Record the `kill_on_exit` breaking change under `Breaking changes`, with the migration a caller relying on the old teardown needs.
1 parent dab8173 commit c023026

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

CHANGES

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,31 @@ $ uvx --from 'libtmux' --prerelease allow python
4545
_Notes on the upcoming release will go here._
4646
<!-- END PLACEHOLDER - ADD NEW CHANGELOG ENTRIES BELOW THIS LINE -->
4747

48+
### Breaking changes
49+
50+
#### Scoping a `Server` no longer kills it (#724)
51+
52+
Leaving a `with` block used to kill any live {class}`~libtmux.Server`, so
53+
`with Server() as server:` around no work at all destroyed the default tmux
54+
daemon and every session in it. A server is a handle on a socket rather than a
55+
connection: the same handle addresses a daemon whether or not your process
56+
started it, so scoping one to a block is not grounds to destroy it.
57+
58+
Teardown is now something you ask for, with the new
59+
{attr}`~libtmux.Server.kill_on_exit`. {class}`~libtmux.Session`,
60+
{class}`~libtmux.Window` and {class}`~libtmux.Pane` are unchanged — those you
61+
get by creating them. See {ref}`context_managers`.
62+
63+
```python
64+
# Before: killed whatever daemon was on that socket
65+
with Server(socket_name="my-work") as server:
66+
pass
67+
68+
# After: nothing is killed unless you say so
69+
with Server(socket_name="my-work", kill_on_exit=True) as server:
70+
pass
71+
```
72+
4873
### Documentation
4974

5075
#### Cleaner `from_env` examples (#719)

0 commit comments

Comments
 (0)