github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/worker/uniter/runner/debug/export_test.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package debug 5 6 import "io" 7 8 // FindSessionWithWriter returns the server session with the writer 9 // specified so the run output can be captured for tests. 10 func (c *HooksContext) FindSessionWithWriter(writer io.Writer) (*ServerSession, error) { 11 session, err := c.FindSession() 12 if session != nil { 13 session.output = writer 14 } 15 return session, err 16 }