| // Copyright 2013 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| // `go mod` ignores file names for the purpose of resolving |
| // dependencies, and fdio doesn't build on not-Fuchsia. |
| //go:build fuchsia |
| |
| package os |
| |
| import ( |
| "syscall" |
| "syscall/zx/fdio" |
| ) |
| |
| func Pipe() (r *File, w *File, err error) { |
| p0, p1, err := fdio.NewPipes() |
| if err != nil { |
| return nil, nil, err |
| } |
| r = NewFile(uintptr(syscall.OpenFDIO(p0)), "|0") |
| w = NewFile(uintptr(syscall.OpenFDIO(p1)), "|1") |
| // TODO CloseOnExec equivalent |
| return r, w, nil |
| } |