MCPcopy
hub / github.com/wavetermdev/waveterm / InstallWsh

Method InstallWsh

pkg/wslconn/wslconn.go:425–450  ·  view source on GitHub ↗
(ctx context.Context, osArchStr string)

Source from the content-addressed store, hash-verified

423}
424
425func (conn *WslConn) InstallWsh(ctx context.Context, osArchStr string) error {
426 conn.Infof(ctx, "running installWsh...\n")
427 client := conn.GetClient()
428 if client == nil {
429 conn.Infof(ctx, "ERROR ssh client is not connected, cannot install\n")
430 return fmt.Errorf("ssh client is not connected, cannot install")
431 }
432 var clientOs, clientArch string
433 var err error
434 if osArchStr != "" {
435 clientOs, clientArch, err = GetClientPlatformFromOsArchStr(ctx, osArchStr)
436 } else {
437 clientOs, clientArch, err = GetClientPlatform(ctx, genconn.MakeWSLShellClient(client))
438 }
439 if err != nil {
440 conn.Infof(ctx, "ERROR detecting client platform: %v\n", err)
441 }
442 conn.Infof(ctx, "detected remote platform os:%s arch:%s\n", clientOs, clientArch)
443 err = CpWshToRemote(ctx, client, clientOs, clientArch)
444 if err != nil {
445 conn.Infof(ctx, "ERROR copying wsh binary to remote: %v\n", err)
446 return fmt.Errorf("error copying wsh binary to remote: %w", err)
447 }
448 conn.Infof(ctx, "successfully installed wsh\n")
449 return nil
450}
451
452func (conn *WslConn) GetClient() *wsl.Distro {
453 conn.Lock.Lock()

Callers 2

tryEnableWshMethod · 0.95

Calls 6

InfofMethod · 0.95
GetClientMethod · 0.95
MakeWSLShellClientFunction · 0.92
GetClientPlatformFunction · 0.70
CpWshToRemoteFunction · 0.70

Tested by

no test coverage detected