mintty.exe is a strange terminal
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 3.3k
- Forks
- 446
- Avg merge
- 2h 16m
- Merged PRs (30d)
- 1
Description
It would be really nice if somebody could look at the following issue:
https://github.com/golang/go/issues/46681
It demonstrates the fact that git-bash.exe and also mingw.exe really behave strange, when we want to the get the controlling terminal file input CONIN$ on windows.
This is basically done in GO with:
package main
import (
"bufio"
"fmt"
"io"
"os"
"syscall"
"golang.org/x/term"
)
func GetCttyIn() (io.Reader, error) {
in, err := syscall.Open("CONIN$", syscall.O_RDWR, 0)
if err != nil {
return nil, err
}
fmt.Println("$CONIN Isterm: ", isatty.IsTerminal(uintptr(in)))
return os.NewFile(uintptr(in), "/dev/tty"), nil
}
func main() {
fmt.Println("In: ", term.IsTerminal(int(os.Stdin.Fd())))
fmt.Println("Out: ", term.IsTerminal(int(os.Stdout.Fd())))
in, err := GetCttyIn()
if err != nil {
panic(err)
}
scanner := bufio.NewScanner(in)
success := scanner.Scan()
if !success {
panic(err)
}
fmt.Println("Res:", scanner.Text())
}
Running the above with echo "asd" | go run main.go
in vs code integrate terminal with bash.exe (MSYS2) **works **(suprisingly) but
running it in the git-bash.exe or msyswin64.exe (mintty.exe) does not work:
VS Code: (bash.exe)
In: false
Out: true
$CONIN Isterm: true
asd
Res: asd
Correct!
Straight mintty.exe
In: false
Out: false // <<<< Thats wrong!
$CONIN Isterm: true
// <<<<--- STUCK at READ here!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Go issue and the main.go reproduction shown in this report; run it with echo "asd" | go run main.go under the listed terminals. Done means the CONIN$ read no longer gets stuck in mintty.exe and matches the working bash.exe behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, shell
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100