MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / InstallWsh

Method InstallWsh

pkg/remote/conncontroller/conncontroller.go:664–690  ·  view source on GitHub ↗
(ctx context.Context, osArchStr string)

Source from the content-addressed store, hash-verified

662}
663
664func (conn *SSHConn) InstallWsh(ctx context.Context, osArchStr string) error {
665 conn.Infof(ctx, "running installWsh...\n")
666 client := conn.GetClient()
667 if client == nil {
668 conn.Infof(ctx, "ERROR ssh client is not connected, cannot install\n")
669 return fmt.Errorf("ssh client is not connected, cannot install")
670 }
671 var clientOs, clientArch string
672 var err error
673 if osArchStr != "" {
674 clientOs, clientArch, err = remote.GetClientPlatformFromOsArchStr(ctx, osArchStr)
675 } else {
676 clientOs, clientArch, err = remote.GetClientPlatform(ctx, genconn.MakeSSHShellClient(client))
677 }
678 if err != nil {
679 conn.Infof(ctx, "ERROR detecting client platform: %v\n", err)
680 return fmt.Errorf("error detecting client platform: %w", err)
681 }
682 conn.Infof(ctx, "detected remote platform os:%s arch:%s\n", clientOs, clientArch)
683 err = remote.CpWshToRemote(ctx, client, clientOs, clientArch)
684 if err != nil {
685 conn.Infof(ctx, "ERROR copying wsh binary to remote: %v\n", err)
686 return fmt.Errorf("error copying wsh binary to remote: %w", err)
687 }
688 conn.Infof(ctx, "successfully installed wsh\n")
689 return nil
690}
691
692func (conn *SSHConn) GetClient() *ssh.Client {
693 conn.lock.Lock()

Callers 1

tryEnableWshMethod · 0.95

Calls 6

InfofMethod · 0.95
GetClientMethod · 0.95
GetClientPlatformFunction · 0.92
MakeSSHShellClientFunction · 0.92
CpWshToRemoteFunction · 0.92

Tested by

no test coverage detected