Commit 34c36915 authored by Austin's avatar Austin

trim possible line terminators from message

parent abc7c6a1
...@@ -5,6 +5,7 @@ package websocket ...@@ -5,6 +5,7 @@ package websocket
import ( import (
"bufio" "bufio"
"bytes"
"io" "io"
"net" "net"
"net/http" "net/http"
...@@ -224,7 +225,7 @@ func pumpStdout(conn *websocket.Conn, stdout io.Reader, done chan struct{}) { ...@@ -224,7 +225,7 @@ func pumpStdout(conn *websocket.Conn, stdout io.Reader, done chan struct{}) {
s := bufio.NewScanner(stdout) s := bufio.NewScanner(stdout)
for s.Scan() { for s.Scan() {
conn.SetWriteDeadline(time.Now().Add(writeWait)) conn.SetWriteDeadline(time.Now().Add(writeWait))
if err := conn.WriteMessage(websocket.TextMessage, s.Bytes()); err != nil { if err := conn.WriteMessage(websocket.TextMessage, bytes.TrimSpace(s.Bytes())); err != nil {
break break
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment