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,20 +101,19 @@ func (ar *AsyncReader) Run() {
|
||||||
// BUG(xiaq): AsyncReader relies on the undocumented fact
|
// BUG(xiaq): AsyncReader relies on the undocumented fact
|
||||||
// that (*os.File).Read returns an *os.File.PathError
|
// that (*os.File).Read returns an *os.File.PathError
|
||||||
patherr, ok := err.(*os.PathError) //.Err
|
patherr, ok := err.(*os.PathError) //.Err
|
||||||
if !ok {
|
if ok && patherr.Err == syscall.EWOULDBLOCK || patherr.Err == syscall.EAGAIN {
|
||||||
ar.errCh <- err
|
|
||||||
return
|
|
||||||
}
|
|
||||||
e := patherr.Err
|
|
||||||
if e == syscall.EWOULDBLOCK || e == syscall.EAGAIN {
|
|
||||||
break ReadRune
|
break ReadRune
|
||||||
} else {
|
} else {
|
||||||
ar.errCh <- err
|
select {
|
||||||
|
case ar.errCh <- err:
|
||||||
|
case <-ar.ctrlCh:
|
||||||
|
ar.rCtrl.Read(cBuf[:])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit terminates the loop of Run.
|
// Quit terminates the loop of Run.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user