summaryrefslogtreecommitdiffstats
path: root/client/go/cmd/command_tester.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/go/cmd/command_tester.go')
-rw-r--r--client/go/cmd/command_tester.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/client/go/cmd/command_tester.go b/client/go/cmd/command_tester.go
index 8eaf6be2c22..201adb8cab7 100644
--- a/client/go/cmd/command_tester.go
+++ b/client/go/cmd/command_tester.go
@@ -7,6 +7,7 @@ package cmd
import (
"bytes"
"crypto/tls"
+ "io"
"io/ioutil"
"net/http"
"os"
@@ -23,6 +24,7 @@ import (
type command struct {
homeDir string
cacheDir string
+ stdin io.ReadWriter
args []string
moreArgs []string
}
@@ -67,6 +69,11 @@ func execute(cmd command, t *testing.T, client *mockHttpClient) (string, string)
var capturedErr bytes.Buffer
stdout = &capturedOut
stderr = &capturedErr
+ if cmd.stdin != nil {
+ stdin = cmd.stdin
+ } else {
+ stdin = os.Stdin
+ }
// Execute command and return output
rootCmd.SetArgs(append(cmd.args, cmd.moreArgs...))