3

I'm creating an application using termbox-go. This library works fine at windows DOS (windows10). But at Bash on Ubuntu on Windows, it was found that when termbox.Init() is run, an error of invalid argument occurs. I thought that as a reason, tty of the terminal may be not raw mode. But I don't know the reason and method to avoid this problem.

My questions are below.

  • Why does this error occur?
  • What is the solution of this problem?

The version of Bash on Ubuntu on Windows is Ubuntu 16.04.3 LTS. The version of Go is 1.8.3. When runtime.GOOS is used, windows DOS and Bash on Ubuntu on Windows show windows and linux, respectively.

Script

package main

import (
    "log"
    "os"

    "github.com/nsf/termbox-go"
)

func main() {
    err := termbox.Init()
    if err != nil {
        log.Println(err.Error())
        os.Exit(1)
    }
}

Result

invalid argument

Error position

This error position was the below script at api.go.

_, err = fcntl(in, syscall.F_SETFL, syscall.O_ASYNC|syscall.O_NONBLOCK)

fcntl() is 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
}

I don't know whether this position will be a solution.

Thank you so much for your time and advices. And I'm sorry for my immature question.

Elsa
  • 654
  • 1
  • 8
  • 21
  • 1
    How did you compile it? As windows application (compiled in command prompt then run it from Bash terminal) or Linux application? Bash on Ubuntu on Windows is in Beta stage, perhaps some part of the linux syscall not yet implemented or having a bug. – putu Aug 28 '17 at 07:20
  • @putu Thank you for your advices. I tried it. But the same error appeared. This may be one of bugs by beta version, as you say. I had thought that this might be able to be used for testing to Linux. – Elsa Aug 28 '17 at 07:51
  • 1
    @Elsa: Your program still fails on the latest versions of Windows 10 (Insider Build 16275) and the Ubuntu app from the Windows Store. – peterSO Aug 29 '17 at 02:34
  • @peterSO Thank you for the information. Although I had thought that it might be able to be used by modifying the library, it was not easy for me yet. I would like to wait for the next update of Ubuntu on Windows. – Elsa Aug 29 '17 at 02:54

0 Answers0