Skip to content

Commit

Permalink
'\n\r' fix clrf
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitafine committed Sep 4, 2022
1 parent 83861a6 commit 7623128
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion environment/docker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (e *Environment) SendCommand(c string) error {
e.SetState(environment.ProcessStoppingState)
}

_, err := e.stream.Conn.Write([]byte(c + "\n"))
_, err := e.stream.Conn.Write([]byte(c + "\r"))

return errors.Wrap(err, "environment/docker: could not write to container stream")
}
Expand Down
5 changes: 4 additions & 1 deletion system/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

var (
cr = []byte(" \r")
lf = []byte(" \n")
crr = []byte("\r\n")
)

Expand Down Expand Up @@ -70,7 +71,9 @@ func ScanReader(r io.Reader, callback func(line []byte)) error {
// in line with that it thinks is the terminal size. Those returns break a lot of output handling,
// so we'll just replace them with proper new-lines and then split it later and send each line as
// its own event in the response.
line = bytes.Replace(line, cr, crr, -1)

line = bytes.Replace(line, cr, lf, -1)
line = bytes.Replace(line, lf, crr, -1)
ns := buf.Len() + len(line)

// If the length of the line value and the current value in the buffer will
Expand Down

0 comments on commit 7623128

Please sign in to comment.