MCPcopy Index your code
hub / github.com/bitfield/script / ExamplePipe_Tee_writers

Function ExamplePipe_Tee_writers

script_test.go:2610–2623  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2608}
2609
2610func ExamplePipe_Tee_writers() {
2611 buf1, buf2 := new(bytes.Buffer), new(bytes.Buffer)
2612 s, err := script.Echo("hello\n").Tee(buf1, buf2).String()
2613 if err != nil {
2614 panic(err)
2615 }
2616 fmt.Print(s)
2617 fmt.Print(buf1.String())
2618 fmt.Print(buf2.String())
2619 // Output:
2620 // hello
2621 // hello
2622 // hello
2623}
2624
2625func ExamplePipe_WithStderr() {
2626 buf := new(bytes.Buffer)

Callers

nothing calls this directly

Calls 3

EchoFunction · 0.92
StringMethod · 0.80
TeeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…