oyvindberg / tui-scala

Beautiful Text-based User Interfaces for Scala
MIT License
207 stars 11 forks source link

IO error: Os { code: 6, kind: Uncategorized, message: "Device not configured" } #59

Closed mccartney closed 11 months ago

mccartney commented 11 months ago

I've encountered this when trying to use the library:

Exception in thread "main" java.lang.ExceptionInInitializerError
        at com.myapp.App.main(App.scala)
Caused by: java.lang.RuntimeException: IO error: Os { code: 6, kind: Uncategorized, message: "Device not configured" }
        at tui.crossterm.CrosstermJni.enableRawMode(Native Method)
        at tui.withTerminal$.apply(withTerminal.scala:9)
        at com.myapp.App$.<clinit>(App.scala:43)
        ... 1 more

It turned out it was because I used Gradle to run my app using this library. And I guess Gradle does something with the terminal.

Reporting here, to help others running into the same problem. My workaround is to let Gradle build the app and then you can run the code without Gradle without issues, e.g.:

./gradlew installDist && app/build/install/app/bin/app