summaryrefslogtreecommitdiffstats
path: root/client/go/cmd/command_tester.go
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-10-06 10:42:50 +0200
committerMartin Polden <mpolden@mpolden.no>2021-10-07 09:33:53 +0200
commita3530f08a4611542f5a318563d96fec63dbf0bb9 (patch)
tree97d75ce7b111571d70c6f39f575974b4d1eb6699 /client/go/cmd/command_tester.go
parent88fcb5fcb1cb5f040653f67d4e0b35abab089166 (diff)
Implement vespa prod init
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...))