(ctx context.Context, connName string)
| 606 | } |
| 607 | |
| 608 | func (ws *WshServer) ConnDisconnectCommand(ctx context.Context, connName string) error { |
| 609 | if conncontroller.IsLocalConnName(connName) { |
| 610 | return nil |
| 611 | } |
| 612 | if strings.HasPrefix(connName, "wsl://") { |
| 613 | distroName := strings.TrimPrefix(connName, "wsl://") |
| 614 | conn := wslconn.GetWslConn(distroName) |
| 615 | if conn == nil { |
| 616 | return fmt.Errorf("distro not found: %s", connName) |
| 617 | } |
| 618 | return conn.Close() |
| 619 | } |
| 620 | connOpts, err := remote.ParseOpts(connName) |
| 621 | if err != nil { |
| 622 | return fmt.Errorf("error parsing connection name: %w", err) |
| 623 | } |
| 624 | conn := conncontroller.MaybeGetConn(connOpts) |
| 625 | if conn == nil { |
| 626 | return fmt.Errorf("connection not found: %s", connName) |
| 627 | } |
| 628 | return conn.Close() |
| 629 | } |
| 630 | |
| 631 | func (ws *WshServer) ConnConnectCommand(ctx context.Context, connRequest wshrpc.ConnRequest) error { |
| 632 | if conncontroller.IsLocalConnName(connRequest.Host) { |
nothing calls this directly
no test coverage detected