Commit 8e5a277b by David Horsley

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.
1 parent 6ece5141
Showing with 3 additions and 1 deletions
...@@ -177,7 +177,9 @@ func (app *App) generateHandler() func(w http.ResponseWriter, r *http.Request) { ...@@ -177,7 +177,9 @@ func (app *App) generateHandler() func(w http.ResponseWriter, r *http.Request) {
go func() { go func() {
<-exit <-exit
fio.Write([]byte{4}) if app.PermitWrite {
fio.Write([]byte{4})
}
fio.Close() fio.Close()
conn.Close() conn.Close()
log.Printf("Connection closed: %s", r.RemoteAddr) log.Printf("Connection closed: %s", r.RemoteAddr)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!