mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
edit: Fix how asyncReader writes to error channel.
This commit is contained in:
parent
34e4f68bc0
commit
0396de6b91
|
@ -101,16 +101,15 @@ func (ar *AsyncReader) Run() {
|
|||
// BUG(xiaq): AsyncReader relies on the undocumented fact
|
||||
// that (*os.File).Read returns an *os.File.PathError
|
||||
patherr, ok := err.(*os.PathError) //.Err
|
||||
if !ok {
|
||||
ar.errCh <- err
|
||||
return
|
||||
}
|
||||
e := patherr.Err
|
||||
if e == syscall.EWOULDBLOCK || e == syscall.EAGAIN {
|
||||
if ok && patherr.Err == syscall.EWOULDBLOCK || patherr.Err == syscall.EAGAIN {
|
||||
break ReadRune
|
||||
} else {
|
||||
ar.errCh <- err
|
||||
return
|
||||
select {
|
||||
case ar.errCh <- err:
|
||||
case <-ar.ctrlCh:
|
||||
ar.rCtrl.Read(cBuf[:])
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user