(ctx context.Context, osArchStr string)
| 423 | } |
| 424 | |
| 425 | func (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 | |
| 452 | func (conn *WslConn) GetClient() *wsl.Distro { |
| 453 | conn.Lock.Lock() |
no test coverage detected