provisioner/shell: comment on why we return right away if advance == 0
/cc @mwhooker
This commit is contained in:
parent
f2c0aeacf5
commit
d3ab4d6b40
|
@ -55,7 +55,11 @@ func (r *UnixReader) Read(p []byte) (n int, err error) {
|
|||
func scanUnixLine(data []byte, atEOF bool) (advance int, token []byte, err error) {
|
||||
advance, token, err = bufio.ScanLines(data, atEOF)
|
||||
if advance == 0 {
|
||||
// If we reached the end of a line without a newline, then
|
||||
// just return as it is. Otherwise the Scanner will keep trying
|
||||
// to scan, blocking forever.
|
||||
return
|
||||
}
|
||||
|
||||
return advance, append(token, '\n'), err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue