Commit f912c31
Fix session deadlock on command exit
After the remote command exits, the channel→pty goroutine blocks
forever on ch.Read() because the SSH channel is still open. The
channel is only closed by handleSession's defer which can't run
until runWithPTY returns — creating a circular dependency.
Remove the WaitGroup entirely. The goroutine is cleaned up when
handleSession closes the channel after runWithPTY returns. This
matches how dropbear and OpenSSH handle session teardown.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent e41c36f commit f912c31
1 file changed
Lines changed: 2 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
259 | 258 | | |
260 | 259 | | |
261 | 260 | | |
262 | | - | |
263 | | - | |
264 | 261 | | |
265 | | - | |
266 | 262 | | |
267 | 263 | | |
268 | 264 | | |
269 | 265 | | |
270 | 266 | | |
271 | | - | |
| 267 | + | |
| 268 | + | |
272 | 269 | | |
273 | 270 | | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | 271 | | |
283 | 272 | | |
284 | 273 | | |
| |||
0 commit comments