Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panics on Bash on Windows #174

Closed
lllama opened this issue Dec 13, 2017 · 7 comments
Closed

Panics on Bash on Windows #174

lllama opened this issue Dec 13, 2017 · 7 comments

Comments

@lllama
Copy link

lllama commented Dec 13, 2017

Running the keyboard demo fails with a panic. It's on line 47 of api.go

	_, err = fcntl(in, syscall.F_SETOWN, syscall.Getpid())
	if runtime.GOOS != "darwin" && err != nil {
		return err
	}

and the error is ultimately returned from fcntl in termbox.go:

func fcntl(fd int, cmd int, arg int) (val int, err error) {
	r, _, e := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), uintptr(cmd),
		uintptr(arg))
	val = int(r)
	if e != 0 {
		err = e
	}
	return
}

Looks like someone else has had a similar issue: https://stackoverflow.com/questions/45911874/termbox-library-can-not-be-initialized-at-termbox-go

I won't pretend to know anything about syscalls but let me know if I can provide any more information.

@lllama
Copy link
Author

lllama commented Jan 15, 2018

Quick update - commenting out the runtime.GOOS check allows the demos to run. By 'run' I mean that the initial interface is displayed but it cannot be interacted with. The process needs killing from another terminal.

@lllama
Copy link
Author

lllama commented Jan 15, 2018

Looks like this might be addressed in Insider builds of Windows: microsoft/WSL#601

@nsf
Copy link
Owner

nsf commented Jan 15, 2018

Also termbox-go works natively on windows (via windows console backend). Sure you might prefer it to run via bash for whatever reason. But I never tested it this way.

@therealplato
Copy link

+1, spent a couple hours trying to diagnose and solve this last night, running inside Linux Subsystem for Windows. I also don't know anything about syscalls so my plan is to try rewriting the project with termui :(

@swtch1
Copy link

swtch1 commented Aug 13, 2018

I don't think mine is different enough to create a new issue. Just going to drop this here:

$ go get -u github.com/nsf/termbox-go
$ go run ~/go/src/github.com/nsf/termbox-go/_demos/keyboard.go
panic: invalid argument

goroutine 1 [running]:
panic(0x5469e0, 0xc82000a738)
        /usr/lib/go-1.6/src/runtime/panic.go:481 +0x3e6
main.main()
        /home/j/go/src/github.com/nsf/termbox-go/_demos/keyboard.go:663 +0x88
exit status 2

Windows BASH
Ubuntu 16.04.5 LTS

@xxxserxxx
Copy link

@therealplato

my plan is to try rewriting the project with termui :(

Did you eventually discover that termui is built on termbox-go? Did you find a different approach?

@scrouthtv
Copy link
Collaborator

I don't know if anyone is still interested in this, but just in case:
I tried running the keyboard test (and some other tests) in WSL2 zsh under Windows 10 Version 2004.
It fully worked for me both in the traditional conemu terminal as well as in the new Terminal emulator.

Let me know if your issue persists and we'll look into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants