diff --git a/cfdtunnel/cfdtunnel.go b/cfdtunnel/cfdtunnel.go index fb9e8b7..27bb9bf 100644 --- a/cfdtunnel/cfdtunnel.go +++ b/cfdtunnel/cfdtunnel.go @@ -1,7 +1,6 @@ package cfdtunnel import ( - "fmt" "os" "os/exec" "strings" @@ -100,10 +99,14 @@ func (args Arguments) runSubCommand(tunnelConfig TunnelConfig) { } cmd := subCommand{exec.Command(args.Command, args.Args...)} + + cmd.Stdin = os.Stdin + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + cmd.setupEnvironmentVariables(tunnelConfig.envVars) - output, err := cmd.CombinedOutput() - fmt.Println(string(output)) + err := cmd.Run() if err != nil { log.Errorf("An error occurred trying to run the command %v: %v", args.Command, err) diff --git a/cfdtunnel/cfdtunnel_test.go b/cfdtunnel/cfdtunnel_test.go index 8cbac12..d299921 100644 --- a/cfdtunnel/cfdtunnel_test.go +++ b/cfdtunnel/cfdtunnel_test.go @@ -185,7 +185,7 @@ func TestRunSubCommandStdOut(t *testing.T) { out, _ := ioutil.ReadAll(r) os.Stdout = rescueStdout - assert.Equal(t, "cfdtunnel.go\n\n", string(out)) + assert.Equal(t, "cfdtunnel.go\n", string(out)) } func TestRunSubCommandMissing(t *testing.T) {