From 7698df5c3e4712a13a9b104b2a1713bac416ec17 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Thu, 12 Oct 2017 12:20:36 +0300 Subject: [PATCH] add more logs to identify #480 root cause --- src/dlangui/platforms/console/dconsole.d | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/dlangui/platforms/console/dconsole.d b/src/dlangui/platforms/console/dconsole.d index c6fb7214..52e4ab31 100644 --- a/src/dlangui/platforms/console/dconsole.d +++ b/src/dlangui/platforms/console/dconsole.d @@ -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;