chatwait: return immediately when session is idle
Fixes a race where the client starts a new chatwait read after the turn has ended (EnsureTrailingNewline already fired), causing a 5-second blocking delay before the shell prompt reappears.
This commit is contained in:
parent
46c57923ec
commit
323ae311fe
|
|
@ -198,6 +198,9 @@ func (h *sessionHelper) fileSpec(name string, mode os.FileMode) FileSpec {
|
||||||
ctx, cancel := context.WithCancel(connCtx)
|
ctx, cancel := context.WithCancel(connCtx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
context.AfterFunc(h.sess.Ctx, cancel)
|
context.AfterFunc(h.sess.Ctx, cancel)
|
||||||
|
if h.sess.Core.State() == "idle" {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
offset := 0
|
offset := 0
|
||||||
if base == "" {
|
if base == "" {
|
||||||
n, _ := h.sess.LogInfo()
|
n, _ := h.sess.LogInfo()
|
||||||
|
|
|
||||||
Reference in New Issue