add more logs to identify #480 root cause

This commit is contained in:
Vadim Lopatin 2017-10-12 12:20:36 +03:00
parent 4700720a8e
commit 7698df5c3e
1 changed files with 16 additions and 2 deletions

View File

@ -244,11 +244,22 @@ class Console {
char ch = 0;
int res = cast(int)read(STDIN_FILENO, &ch, 1);
if (res < 0) {
switch (errno) {
auto err = errno;
switch (err) {
case EBADF:
Log.e("rawRead stdin EINVAL - stopping terminal");
_stopped = true;
return null;
case EFAULT:
Log.e("rawRead stdin EINVAL - stopping terminal");
_stopped = true;
return null;
case EINVAL:
Log.e("rawRead stdin EINVAL - stopping terminal");
_stopped = true;
return null;
case EIO:
Log.e("rawRead stdin EIO - stopping terminal");
_stopped = true;
return null;
default:
@ -278,6 +289,7 @@ class Console {
import core.sys.posix.unistd;
int res = cast(int)write(STDOUT_FILENO, s.ptr, s.length);
if (res < 0) {
Log.e("rawWrite error ", errno, " - stopping terminal");
_stopped = true;
}
return (res > 0);
@ -816,8 +828,10 @@ class Console {
/// wait for input, handle input
bool pollInput() {
if (_stopped)
if (_stopped) {
debug Log.i("Console _stopped flag is set - returning false from pollInput");
return false;
}
version(Windows) {
INPUT_RECORD record;
DWORD eventsRead;