fix(readline): check stdin error properly

pull/143/head
TorchedSammy 2022-04-19 10:30:04 -04:00
parent bee8d6e9e6
commit b83c09a2b3
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 2 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package readline
import (
"bytes"
"errors"
"fmt"
"os"
"regexp"
@ -78,9 +79,7 @@ func (rl *Instance) Readline() (string, error) {
var err error
i, err = os.Stdin.Read(b)
if err != nil {
// i shouldnt really check the error like this but i dont know what
// the actual thing is so
if err.Error() == "read /dev/stdin: resource temporarily unavailable" {
if errors.Is(err, syscall.EAGAIN) {
err = syscall.SetNonblock(syscall.Stdin, false)
if err == nil {
continue