mattn / go-tty

MIT License
208 stars 18 forks source link

(Linux) tty-mode can not be switched from raw-mode to cooked-mode #13

Closed hymkor closed 5 years ago

hymkor commented 5 years ago

When I tried to confirm the influence of #12 to my application, I found the tty-mode can not be changed from raw-mode to cocked-mode in Linux (On Windows, no problem)

package main

import (
        "github.com/mattn/go-tty"
)

func main(){
        tty1,err := tty.Open()
        if err != nil {
                panic(err.Error())
        }
        defer tty1.Close()

        print("cocked-mode(1)\n1\n2\n3\n")

        clean,err := tty1.Raw()
        if err != nil {
                panic(err.Error())
        }

        print("raw-mode\n1\n2\n3\n")

        clean()

        print("cocked-mode(2)\n1\n2\n3\n")
}

image

I will make the patch.

mattn commented 5 years ago

Closed by #14