diff --git a/command.go b/command.go index 451b7b9..28597c8 100644 --- a/command.go +++ b/command.go @@ -87,8 +87,6 @@ func WithCustomStdout(writers ...io.Writer) func(c *Command) { return func(c *Command) { writers = append(writers, &c.stdout, &c.combined) c.StdoutWriter = NewMultiplexedWriter(writers...) - - c.StderrWriter = NewMultiplexedWriter(&c.stderr, &c.combined) } } @@ -97,8 +95,6 @@ func WithCustomStderr(writers ...io.Writer) func(c *Command) { return func(c *Command) { writers = append(writers, &c.stderr, &c.combined) c.StderrWriter = NewMultiplexedWriter(writers...) - - c.StdoutWriter = NewMultiplexedWriter(&c.stdout, &c.combined) } } diff --git a/examples/standard_streams.go b/examples/standard_streams.go index 69e8cb0..628f3f5 100644 --- a/examples/standard_streams.go +++ b/examples/standard_streams.go @@ -2,6 +2,7 @@ package examples import "github.com/SimonBaeumer/cmd" +// CreateNewCommandWithStandardStream create new standard stream example func CreateNewCommandWithStandardStream() { c := cmd.NewCommand("echo hello; sleep 1; echo another;", cmd.WithStandardStreams) c.Execute() diff --git a/examples/working_dir.go b/examples/working_dir.go index b3ff404..3d7cc20 100644 --- a/examples/working_dir.go +++ b/examples/working_dir.go @@ -2,6 +2,7 @@ package examples import "github.com/SimonBaeumer/cmd" +// CreateWithWorkingDir sets the current working directory func CreateWithWorkingDir() { setWorkingDir := func(c *cmd.Command) { c.WorkingDir = "/tmp"