1
0
mirror of https://github.com/golang/go synced 2024-11-22 21:10:03 -07:00

add os.Pipe

R=r
OCL=15989
CL=16001
This commit is contained in:
Russ Cox 2008-09-26 14:31:17 -07:00
parent 185a309737
commit 5267db394c

View File

@ -82,3 +82,12 @@ func (fd *FD) WriteString(s string) (ret int, err *Error) {
r, e := syscall.write(fd.fd, &b[0], int64(len(s)));
return int(r), ErrnoToError(e)
}
export func Pipe() (fd1 *FD, fd2 *FD, err *Error) {
var p [2]int64
r, e := syscall.pipe(&p);
if e != 0 {
return nil, nil, ErrnoToError(e)
}
return NewFD(p[0]), NewFD(p[1]), nil
}