go-prompt icon indicating copy to clipboard operation
go-prompt copied to clipboard

[Bug] When starting docker image with CMD it panics

Open JesterOrNot opened this issue 5 years ago • 5 comments

Bug reports

Please file a bug report here.

Expected Behavior

program works as expected

Current Behavior and Steps to Reproduce

image I start docker image

FROM homebrew/brew as build

RUN brew install gosh-terminal/gosh/gosh

RUN useradd -s /home/linuxbrew/.linuxbrew/bin/gosh gosh-user
USER gosh-user
ENV SHELL=/home/linuxbrew/.linuxbrew/bin/gosh
CMD ["/bin/bash", "-c", "gosh"]

starts and I am unable to use input when you click enter it crashes

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: Docker
  • Terminal Emulator: (i.e. iTerm2)
  • tag of go-prompt or commit revision:

here is the code

command := prompt.Input("", Completer, prompt.OptionHistory(GetCommandHist()), prompt.OptionSuggestionBGColor(prompt.DefaultColor),
			prompt.OptionInputTextColor(prompt.Cyan),
			prompt.OptionMaxSuggestion(6),
			prompt.OptionTitle("gosh"),
			prompt.OptionAddKeyBind(prompt.KeyBind{
				Key: prompt.ControlC,
				Fn: func(buf *prompt.Buffer) {
					ThePrompt()
				}}),

JesterOrNot avatar Jan 17 '20 18:01 JesterOrNot

Any updates on this issue?

JesterOrNot avatar Jan 28 '20 18:01 JesterOrNot

Any updates on this?

JesterOrNot avatar Feb 27 '20 19:02 JesterOrNot

I hit the same issue using KVM in vnc console. Also tried to run from latest revision, but with no luck. Is there any update?

have the issue with just starting the binary inside:

[vesbkp@master-0 ~]$ vpmu
panic: runtime error: integer divide by zero

goroutine 1 [running]:
marek/vpm/vendor/github.com/c-bata/go-prompt.(*Render).toPos(...)
	/go/src/marek/vpm/vendor/github.com/c-bata/go-prompt/render.go:268
marek/vpm/vendor/github.com/c-bata/go-prompt.(*Render).move(0xc000028000, 0x1a, 0x0, 0x4)
	/go/src/marek/vpm/vendor/github.com/c-bata/go-prompt/render.go:257 +0xcc
marek/vpm/vendor/github.com/c-bata/go-prompt.(*Render).clear(0xc000028000, 0x1a)
	/go/src/marek/vpm/vendor/github.com/c-bata/go-prompt/render.go:244 +0x3e
marek/vpm/vendor/github.com/c-bata/go-prompt.(*Render).BreakLine(0xc000028000, 0xc000328040)
	/go/src/marek/vpm/vendor/github.com/c-bata/go-prompt/render.go:231 +0x209
marek/vpm/vendor/github.com/c-bata/go-prompt.(*Prompt).feed(0xc00015e000, 0xc000365400, 0x1, 0x400, 0x1, 0x5)
	/go/src/marek/vpm/vendor/github.com/c-bata/go-prompt/prompt.go:120 +0x2a6
marek/vpm/vendor/github.com/c-bata/go-prompt.(*Prompt).Run(0xc00015e000)
	/go/src/marek/vpm/vendor/github.com/c-bata/go-prompt/prompt.go:72 +0x570
main.main()
	/go/src/marek/vpm/cmd/vpmu/main.go:77 +0x206

mceloud avatar Mar 09 '20 12:03 mceloud

So it errors during any kind of virtualization hmm.

JesterOrNot avatar Mar 09 '20 12:03 JesterOrNot

I debugged a little and to root cause is that rows and cols are set to 0 size in console

$ stty size
0 0

changing the size worked for me $ stty cols 83 rows 40

mceloud avatar Mar 09 '20 16:03 mceloud