From 8e5a277bb3e02f12c92d11b83c9f3a493f915185 Mon Sep 17 00:00:00 2001 From: David Horsley Date: Tue, 18 Aug 2015 10:47:15 +1000 Subject: [PATCH] Only send EOF in writable sessions Currently EOF is sent to the pty even when read-only mode is requested. This can cause trouble in attached tmux sessions, for example. Since the EOF typically used in shells as a shortcut exit, this can result in undesired disconnects. --- app/app.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 92d1624..d0d8df4 100644 --- a/app/app.go +++ b/app/app.go @@ -177,7 +177,9 @@ func (app *App) generateHandler() func(w http.ResponseWriter, r *http.Request) { go func() { <-exit - fio.Write([]byte{4}) + if app.PermitWrite { + fio.Write([]byte{4}) + } fio.Close() conn.Close() log.Printf("Connection closed: %s", r.RemoteAddr)