Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
6039a414
Commit
6039a414
authored
Jan 29, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
io: fix nil Write bug in Pipe
R=nigeltao_golang CC=golang-dev
https://golang.org/cl/194132
parent
d7a5ccf3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
pipe.go
src/pkg/io/pipe.go
+1
-1
pipe_test.go
src/pkg/io/pipe_test.go
+22
-0
No files found.
src/pkg/io/pipe.go
View file @
6039a414
...
...
@@ -39,7 +39,7 @@ func (p *pipe) Read(data []byte) (n int, err os.Error) {
if
!
p
.
wclosed
{
p
.
wpend
=
<-
p
.
cr
}
if
p
.
w
pend
==
nil
{
if
p
.
w
closed
{
return
0
,
p
.
werr
}
p
.
wtot
=
0
...
...
src/pkg/io/pipe_test.go
View file @
6039a414
...
...
@@ -236,3 +236,25 @@ func TestPipeWriteClose(t *testing.T) {
}
}
}
func
TestWriteEmpty
(
t
*
testing
.
T
)
{
r
,
w
:=
Pipe
()
go
func
()
{
w
.
Write
([]
byte
{})
w
.
Close
()
}()
var
b
[
2
]
byte
ReadFull
(
r
,
b
[
0
:
2
])
r
.
Close
()
}
func
TestWriteNil
(
t
*
testing
.
T
)
{
r
,
w
:=
Pipe
()
go
func
()
{
w
.
Write
(
nil
)
w
.
Close
()
}()
var
b
[
2
]
byte
ReadFull
(
r
,
b
[
0
:
2
])
r
.
Close
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment