Repository navigation
v0.1.4
prevent orphaned tmux -C subprocesses on abnormal consumer exit
previously the control transport spawned a long-lived tmux -C attach-session child that was reliably killed only by an explicit (*Tmux).Close(). a consumer that exited without Close — crash, signal, or a short-lived subcommand — orphaned the child, leaving it attached to the tmux server until the server died. in practice this showed up as dozens of accumulated orphans saturating the single-threaded tmux server.
fixes
- add build-tagged
sysProcAttr()helpers applied to the spawned command: linux setsPdeathsig: SIGKILL(the kernel reaps the child on parent death) plusSetpgid; darwin/bsd setSetpgidonly, since there is no pdeathsig equivalent; non-unix returns nil (440c9d0) - derive an internal cancelable lifetime context in
New, cancelled byClose()and on child exit, giving a secondCommandContext-based kill path independent ofProcess.Kill(440c9d0)
additions
- expose
NewTmuxContext(ctx, socket, ...)so consumers can bind a client's lifetime to e.g.signal.NotifyContext(440c9d0)
notes
- calling
Close()remains mandatory on macOS/bsd, where there is no parent-death signal to fall back on
tests
- platform helper coverage (
Setpgideverywhere,Pdeathsigon linux) - that
NewwiresSysProcAttronto the command - that
NewTmuxContextthreads its context through to the dialer
upgrading
go get github.com/atomicstack/gotmuxcc@v0.1.4