From c5feef77c93bcfa81f7cdf53faff354243b56d5e Mon Sep 17 00:00:00 2001 From: lucklove Date: Thu, 23 Jul 2020 17:25:48 +0800 Subject: [PATCH] test Signed-off-by: lucklove --- pkg/cluster/executor/ssh.go | 4 +++- pkg/exec/run.go | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/cluster/executor/ssh.go b/pkg/cluster/executor/ssh.go index 1452b6d4eb..b51c1cdd6c 100644 --- a/pkg/cluster/executor/ssh.go +++ b/pkg/cluster/executor/ssh.go @@ -118,7 +118,9 @@ func NewSSHExecutor(c SSHConfig, sudo bool, native bool) Executor { Locale: "C", Sudo: sudo, } - _, _, e.ConnectionTestResult = e.Execute(connectionTestCommand, false, c.Timeout) + if c.Password != "" || (c.KeyFile != "" && c.Passphrase != "") { + _, _, e.ConnectionTestResult = e.Execute(connectionTestCommand, false, executeDefaultTimeout) + } return e } diff --git a/pkg/exec/run.go b/pkg/exec/run.go index a2232aa3ae..9e9eb0c211 100644 --- a/pkg/exec/run.go +++ b/pkg/exec/run.go @@ -17,7 +17,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/fatih/color" "math" "os" "os/exec" @@ -28,6 +27,8 @@ import ( "syscall" "time" + "github.com/fatih/color" + "github.com/pingcap/errors" "github.com/pingcap/tiup/pkg/environment" "github.com/pingcap/tiup/pkg/localdata" @@ -247,7 +248,7 @@ func launchComponent(ctx context.Context, component string, version v0manifest.V p := &localdata.Process{ Component: component, CreatedTime: time.Now().Format(time.RFC3339), - Exec: binPath, + Exec: c.Args[0], Args: args, Dir: c.Dir, Env: c.Env,