Skip to content

[Bug] panic: runtime error: integer divide by zero #277

@rsivasamgit

Description

@rsivasamgit

Bug reports

We are using go-prompt and once in a while when we get into the CLI prompt, a "divide by zero" error is seen

panic: runtime error: integer divide by zero

goroutine 1 [running]:
github.com/c-bata/go-prompt.(*Render).toPos(...)
/go/pkg/mod/github.com/c-bata/[email protected]/render.go:269
github.com/c-bata/go-prompt.(*Render).move(0x0?, 0x0?, 0xc00006f8b8?)
/go/pkg/mod/github.com/c-bata/[email protected]/render.go:258 +0xbb
github.com/c-bata/go-prompt.(*Render).clear(0xc0004b8ea0, 0x17487af?)
/go/pkg/mod/github.com/c-bata/[email protected]/render.go:245 +0x25
github.com/c-bata/go-prompt.(*Render).BreakLine(0xc0004b8ea0, 0xc000424140)
/go/pkg/mod/github.com/c-bata/[email protected]/render.go:229 +0x22d
github.com/c-bata/go-prompt.(*Prompt).feed(0xc0000e6000, {0xc0004f9800, 0x1, 0x400})
/go/pkg/mod/github.com/c-bata/[email protected]/prompt.go:124 +0x2fa
github.com/c-bata/go-prompt.(*Prompt).Run(0xc0000e6000)
/go/pkg/mod/github.com/c-bata/[email protected]/prompt.go:71 +0x525
bitbucket.rks-cloud.com/edge/seinfra-common-app/pkg/cobrashell.New.func1(0xc000468600?, {0x173ef40?, 0x0?, 0x0?})
/stage/pkg/cobrashell/shell.go:62 +0xf2
github.com/spf13/cobra.(*Command).execute(0xc000468600, {0x24b6e68, 0x0, 0x0})
/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x847
github.com/spf13/cobra.(*Command).ExecuteC(0x246d000)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:992

The issue is not seen always, it is seen once in every 6 attempts or so and rest of the time, the CLI renders properly

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions