Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds Program.Write method #268

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions tea.go
Expand Up @@ -111,6 +111,14 @@ type Program struct {
windowsStdin *os.File //nolint:golint,structcheck,unused
}

// Write gives direct access to the underlying Writer. Useful for an inline
// program that wants to print things to the terminal during its execution.
func (p Program) Write(b []byte) (n int, err error) {
p.mtx.Lock()
defer p.mtx.Unlock()
return p.output.Write(b)
}

// Batch performs a bunch of commands concurrently with no ordering guarantees
// about the results. Use a Batch to return several commands.
//
Expand Down