Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pipe ¶
type Pipe interface { io.ReadWriteCloser // Name of the pipe that was created Name() StreamNames }
Pipe is the interface to interact with the pipes that are created
func NewDuplexPipe ¶
NewDuplexPipe returns an io.ReaadWriteCloser that maintains an in and an out pipe to write and read from for inter-process comunication
func NewFifoPipe ¶
NewFifoPipe returns an io.ReaadWriteCloser that maintains an in and an out pipe to write and read from for inter-process comunication
Example ¶
// Create a new pipe pipe, err := NewFifoPipe("test.pipe", os.O_RDWR) if err != nil { panic(err) } // Process 1 - Prints to the pipe go func() { fmt.Fprintln(pipe, "Hello pipe!") }() // Process 2 - Reads from the pipe reader := bufio.NewReader(pipe) result, err := reader.ReadString('\n') if err != nil { panic(err) } fmt.Println(result) // Closing the pipe will also delete the pipe of the same name created if err := pipe.Close(); err != nil { panic(err) }
Output: Hello pipe!
func NewNamedDuplexPipe ¶
NewNamedDuplexPipe returns an io.ReaadWriteCloser that maintains an in and an out pipe to write and read from for inter-process comunication
func TempFifoPipe ¶
TempFifoPipe returns a pipe pointing at a temp file with O_RDWR O_APPEND privlages
Example ¶
// Create a new pipe pipe, err := TempFifoPipe() if err != nil { panic(err) } // Process 1 - Prints to the pipe go func() { fmt.Fprintln(pipe, "Hello pipe!") }() // Process 2 - Reads from the pipe reader := bufio.NewReader(pipe) result, err := reader.ReadString('\n') if err != nil { panic(err) } fmt.Println(result) // Closing the pipe will also delete the pipe of the same name created if err := pipe.Close(); err != nil { panic(err) }
Output: Hello pipe!
type StreamNames ¶
type StreamNames struct {
In, Out string
}
StreamNames contains the io named streams as file names
Click to show internal directories.
Click to hide internal directories.