How do terminate input on git bash when scanning for user input?

39 Views Asked by At

I am trying to collect user input on a git hook and am doing so with the guidance from this post: How do I prompt the user from within a commit-msg hook?

I am following this approach using Golang of opening CON (for windows, /dev/tty for mac +linux) to collect user input. This approach works for powershell and cmd, however for git bash after typing in user input and ending it with the enter button, it seems to still be collecting the user input. Wondering if anyone knows how/why that git bash is hanging on user input?

con, err := os.Open("CON")
    if err == nil {

        os.Stdin = con

        reader := bufio.NewReader(os.Stdin)
        line, _ := reader.ReadString('\n'
}
0

There are 0 best solutions below