github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/pipes/streams/stdtest.go (about)

     1  package streams
     2  
     3  import "context"
     4  
     5  // Stdtest is a testing Io interface user to workaround writing to the terminal
     6  type Stdtest struct {
     7  	Stdin
     8  }
     9  
    10  // NewStdtest creates a new stream.Io interface for piping data between test
    11  // processes that need to spoof an PTY
    12  func NewStdtest() (stdtest *Stdtest) {
    13  	stdtest = new(Stdtest)
    14  	stdtest.max = DefaultMaxBufferSize
    15  	stdtest.ctx, stdtest.forceClose = context.WithCancel(context.Background())
    16  	return
    17  }
    18  
    19  // IsTTY returns true because the Stdtest stream is a pseudo-TTY mockup
    20  func (stdtest *Stdtest) IsTTY() bool { return true }