github.com/billybanfield/evergreen@v0.0.0-20170525200750-eeee692790f7/command/output_writers.go (about)

     1  package command
     2  
     3  // generic implementations of io.Writer
     4  
     5  // A trivial implementation of io.Writer that saves the last thing written.
     6  // Useful for some testing situations where a line of stdout or stderr needs
     7  // to be checked.
     8  type CacheLastWritten struct {
     9  	LastWritten []byte
    10  }
    11  
    12  func (self *CacheLastWritten) Write(p []byte) (int, error) {
    13  	self.LastWritten = p
    14  	return len(p), nil
    15  }