(cmd *cobra.Command, args []string)
| 29 | } |
| 30 | |
| 31 | func wslRun(cmd *cobra.Command, args []string) (rtnErr error) { |
| 32 | defer func() { |
| 33 | sendActivity("wsl", rtnErr == nil) |
| 34 | }() |
| 35 | |
| 36 | var err error |
| 37 | if distroName == "" { |
| 38 | // get default distro from the host |
| 39 | distroName, err = wshclient.WslDefaultDistroCommand(RpcClient, nil) |
| 40 | if err != nil { |
| 41 | return err |
| 42 | } |
| 43 | } |
| 44 | if !strings.HasPrefix(distroName, "wsl://") { |
| 45 | distroName = "wsl://" + distroName |
| 46 | } |
| 47 | blockId := RpcContext.BlockId |
| 48 | if blockId == "" { |
| 49 | return fmt.Errorf("cannot determine blockid (not in JWT)") |
| 50 | } |
| 51 | data := wshrpc.CommandSetMetaData{ |
| 52 | ORef: waveobj.MakeORef(waveobj.OType_Block, blockId), |
| 53 | Meta: map[string]any{ |
| 54 | waveobj.MetaKey_Connection: distroName, |
| 55 | }, |
| 56 | } |
| 57 | err = wshclient.SetMetaCommand(RpcClient, data, nil) |
| 58 | if err != nil { |
| 59 | return fmt.Errorf("setting connection in block: %w", err) |
| 60 | } |
| 61 | WriteStderr("switched connection to %q\n", distroName) |
| 62 | return nil |
| 63 | } |
nothing calls this directly
no test coverage detected