From 86f0f8b5451955ad4b09b5a9d010e6f3da659264 Mon Sep 17 00:00:00 2001 From: jiahui Date: Tue, 12 Dec 2023 11:48:34 +0800 Subject: [PATCH] Optimize remote execution command return error message --- pkg/ssh/remote.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/ssh/remote.go b/pkg/ssh/remote.go index b455f80a404..ac077bcdc4b 100644 --- a/pkg/ssh/remote.go +++ b/pkg/ssh/remote.go @@ -191,7 +191,10 @@ func NewRemoteFromSSH(clusterName string, sshInterface Interface) *Remote { func (s *Remote) executeRemoteUtilSubcommand(ip, cmd string) error { cmd = fmt.Sprintf("%s %s", s.pathResolver.RootFSSealctlPath(), cmd) - return s.execer.CmdAsync(ip, cmd) + if err := s.execer.CmdAsync(ip, cmd); err != nil { + return fmt.Errorf("failed to execute remote command `%s`: %v", cmd, err) + } + return nil } func (s *Remote) outputRemoteUtilSubcommand(ip, cmd string) (string, error) {