Skip to content

Commit

Permalink
fixed misleading error
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed Jun 5, 2022
1 parent d587b59 commit 9e4bed4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions input.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package keyboard

import (
"errors"
"fmt"
"io"
"os"
"unicode/utf8"

"atomicgo.dev/keyboard/internal"
Expand Down Expand Up @@ -167,6 +169,9 @@ func getKeyPress(input io.Reader) (keys.Key, error) {
// Read
numBytes, err := input.Read(buf[:])
if err != nil {
if errors.Is(err, os.ErrClosed) {
return keys.Key{}, nil
}
return keys.Key{}, fmt.Errorf("could not read stdin: %w", err)
}

Expand Down

0 comments on commit 9e4bed4

Please sign in to comment.