blocking

package
v0.1.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader is an io.Reader that blocks until the underlying reader until returns something other than io.EOF.

On EOF, it'll keep trying to read again every 10ms.

The purpose of this is to be used to "emulate a STDIN" from another io.Reader, for example, a bytes.Buffer.

We need that because when we connect into an app through wishlist, we need to keep a copy of STDIN (named handoffstdin in most places). That copy is a bytes.Buffer, which would EOF on last byte, but we are still writing to it... so it shouldn't really EOF. Hence, this Reader. It'll never EOF, and will keep trying to read until another error happens.

func New

func New(r io.Reader) Reader

New wraps a given io.Reader into a BlockingReader.

func (Reader) Read

func (r Reader) Read(data []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL