command/remote_execute.go
func (executor *DefaultRemoteExecutor) Execute(dest io.Writer, command string) (err error) {
	var session SSHSession
	var stdoutReader io.Reader

	if executor.once.Do(executor.LazyClientDial); executor.Client != nil {
		session, err = executor.Client.NewSession()
		defer session.Close()
		if err != nil {
			return
		}
		stdoutReader, err = session.StdoutPipe()
		if err != nil {
			return
		}
		err = session.Start(command)
		if err != nil {
			return
		}
		_, err = io.Copy(dest, stdoutReader)
		if err != nil {
			return
		}
		err = session.Wait()
	} else {
		err = fmt.Errorf("un-initialized client executor")
		lo.G.Error(err.Error())
	}
	return
}
func (executor *DefaultRemoteExecutor) Execute(dest io.Writer, command string) (err error) {
	var session SSHSession
	var stdoutReader io.Reader

	if executor.once.Do(executor.LazyClientDial); executor.Client != nil {
		session, err = executor.Client.NewSession()
		defer session.Close()
		if err != nil {
			return
		}
		stdoutReader, err = session.StdoutPipe()
		if err != nil {
			return
		}
		err = session.Start(command)
		if err != nil {
			return
		}
		_, err = io.Copy(dest, stdoutReader)
		if err != nil {
			return
		}
		err = session.Wait()
	} else {
		err = fmt.Errorf("un-initialized client executor")
		lo.G.Error(err.Error())
	}
	return
}
//Execute - Copy the output from a command to the specified io.Writer