Skip to content

Commit

Permalink
Concatenate args to avoid out of bound issues
Browse files Browse the repository at this point in the history
fixes: #114

```bash
sesh connect $(sesh list -i | gum filter --limit 1 --placeholder 'Pick a
session' --height 60 --prompt='⚡')panic: runtime error: slice bounds out
of range [4:3]goroutine 1
[running]:github.com/joshmedeski/sesh/icon.(*RealIcon).RemoveIcon(0x140001288c0?,
{0x16f916fad, 0x3})        /home/runner/work/sesh/sesh/icon/icon.go:55
+0x128github.com/joshmedeski/sesh/seshcli.App.Connect.func1(0x1400018f958?)
/home/runner/work/sesh/sesh/seshcli/connect.go:70
+0xb4github.com/urfave/cli/v2.(*Command).Run(0x140001be2c0,
0x140001288c0, {0x14000111350, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:279
+0x754github.com/urfave/cli/v2.(*Command).Run(0x140001be6e0,
0x14000128780, {0x14000128040, 0x4, 0x4})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:272
+0x964github.com/urfave/cli/v2.(*App).RunContext(0x1400016a200,
{0x1008088b8?, 0x100a05320}, {0x14000128040, 0x4, 0x4})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:337
+0x534github.com/urfave/cli/v2.(*App).Run(0x10070cec7?, {0x14000128040?,
0x0?, 0x0?})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:311
+0x3cmain.main()        /home/runner/work/sesh/sesh/main.go:14 +0xb0
```
  • Loading branch information
kevinrobayna committed Aug 23, 2024
1 parent f999ba7 commit 119c67f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion seshcli/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package seshcli
import (
"errors"
"fmt"
"strings"

"github.com/joshmedeski/sesh/connector"
"github.com/joshmedeski/sesh/icon"
Expand Down Expand Up @@ -62,7 +63,7 @@ func Connect(c connector.Connector, i icon.Icon) *cli.Command {
if cCtx.NArg() == 0 {
return errors.New("please provide a session name")
}
name := cCtx.Args().First()
name := strings.Join(cCtx.Args().Slice(), " ")
if name == "" {
return nil
}
Expand Down

0 comments on commit 119c67f

Please sign in to comment.