Skip to content

Commit 3c50ae7

Browse files
authored
Merge pull request #15 from SimonBaeumer/remove-multiplexed-writer
Replace multiplexed_writer with built-in io.MultiWriter
2 parents ba20057 + d186d1c commit 3c50ae7

File tree

3 files changed

+6
-92
lines changed

3 files changed

+6
-92
lines changed

command.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ func NewCommand(cmd string, options ...func(*Command)) *Command {
5959
Env: []string{},
6060
}
6161

62-
c.StdoutWriter = NewMultiplexedWriter(&c.stdout, &c.combined)
63-
c.StderrWriter = NewMultiplexedWriter(&c.stderr, &c.combined)
62+
c.StdoutWriter = io.MultiWriter(&c.stdout, &c.combined)
63+
c.StderrWriter = io.MultiWriter(&c.stderr, &c.combined)
6464

6565
for _, o := range options {
6666
o(c)
@@ -78,23 +78,23 @@ func NewCommand(cmd string, options ...func(*Command)) *Command {
7878
// c.Execute()
7979
//
8080
func WithStandardStreams(c *Command) {
81-
c.StdoutWriter = NewMultiplexedWriter(os.Stdout, &c.stdout, &c.combined)
82-
c.StderrWriter = NewMultiplexedWriter(os.Stderr, &c.stdout, &c.combined)
81+
c.StdoutWriter = io.MultiWriter(os.Stdout, &c.stdout, &c.combined)
82+
c.StderrWriter = io.MultiWriter(os.Stderr, &c.stdout, &c.combined)
8383
}
8484

8585
// WithCustomStdout allows to add custom writers to stdout
8686
func WithCustomStdout(writers ...io.Writer) func(c *Command) {
8787
return func(c *Command) {
8888
writers = append(writers, &c.stdout, &c.combined)
89-
c.StdoutWriter = NewMultiplexedWriter(writers...)
89+
c.StdoutWriter = io.MultiWriter(writers...)
9090
}
9191
}
9292

9393
// WithCustomStderr allows to add custom writers to stderr
9494
func WithCustomStderr(writers ...io.Writer) func(c *Command) {
9595
return func(c *Command) {
9696
writers = append(writers, &c.stderr, &c.combined)
97-
c.StderrWriter = NewMultiplexedWriter(writers...)
97+
c.StderrWriter = io.MultiWriter(writers...)
9898
}
9999
}
100100

multiplexed_writer.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

multiplexed_writer_test.go

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)