Skip to content

Commit

Permalink
fixed stop routine with syscall on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed Jun 5, 2022
1 parent e3c243e commit 844fa89
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions input.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,18 @@ var hexCodes = map[string]keys.Key{
func getKeyPress() (keys.Key, error) {
var buf [256]byte

fmt.Println("a")
// Read
numBytes, err := inputTTY.Read(buf[:])
if err != nil {
if errors.Is(err, os.ErrClosed) {
return keys.Key{}, nil
}

if err.Error() == "EOF" {
return keys.Key{}, nil
}
return keys.Key{}, fmt.Errorf("could not read stdin: %w", err)
}
fmt.Println("b")

// Check if it's a sequence
if k, ok := sequences[string(buf[:numBytes])]; ok {
Expand Down

0 comments on commit 844fa89

Please sign in to comment.