mirror of https://github.com/Hilbis/Hilbish
fix(readline): check stdin error properly
parent
bee8d6e9e6
commit
b83c09a2b3
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue