Commit 659d1df1 authored by Akshat Kumar's avatar Akshat Kumar Committed by Rob Pike

pkg/go/ast: Avoid doing zero-length writes to the fd.

After each line, ast.Print would do a zero-length write,
which would hit the boundary condition on Plan 9 when
reading over pipes (since message boundaries are
preserved). This change makes sure we only do positive-
length writes.

R=rsc, rminnich, dave, r
CC=golang-dev
https://golang.org/cl/6558046
parent 3ec7be64
...@@ -108,8 +108,10 @@ func (p *printer) Write(data []byte) (n int, err error) { ...@@ -108,8 +108,10 @@ func (p *printer) Write(data []byte) (n int, err error) {
} }
p.last = b p.last = b
} }
if len(data) > n {
m, err = p.output.Write(data[n:]) m, err = p.output.Write(data[n:])
n += m n += m
}
return return
} }
......
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