(ctx context.Context)
| 669 | } |
| 670 | |
| 671 | func (conn *WslConn) connectInternal(ctx context.Context) error { |
| 672 | conn.Infof(ctx, "connectInternal %s\n", conn.GetName()) |
| 673 | client, err := wsl.GetDistro(ctx, conn.Name) |
| 674 | if err != nil { |
| 675 | conn.Infof(ctx, "ERROR GetDistro: %s\n", err) |
| 676 | log.Printf("error: failed to get distro %s: %s\n", conn.GetName(), err) |
| 677 | return err |
| 678 | } |
| 679 | conn.WithLock(func() { |
| 680 | conn.Client = client |
| 681 | }) |
| 682 | go func() { |
| 683 | defer func() { |
| 684 | panichandler.PanicHandler("wsl-waitForDisconnect", recover()) |
| 685 | }() |
| 686 | conn.waitForDisconnect() |
| 687 | }() |
| 688 | wshResult := conn.tryEnableWsh(ctx, conn.GetName()) |
| 689 | if !wshResult.WshEnabled { |
| 690 | if wshResult.WshError != nil { |
| 691 | conn.Infof(ctx, "ERROR enabling wsh: %v\n", wshResult.WshError) |
| 692 | conn.Infof(ctx, "will connect with wsh disabled\n") |
| 693 | } else { |
| 694 | conn.Infof(ctx, "wsh not enabled: %s\n", wshResult.NoWshReason) |
| 695 | } |
| 696 | } |
| 697 | conn.persistWshInstalled(ctx, wshResult) |
| 698 | return nil |
| 699 | } |
| 700 | |
| 701 | func (conn *WslConn) waitForDisconnect() { |
| 702 | log.Printf("wait for disconnect in %+#v", conn) |
no test coverage detected