From cc85663ac368ac6bbe61bfc12378fcf264625957 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Thu, 12 Oct 2017 12:29:33 +0300 Subject: [PATCH] add more logs to identify #480 root cause; trying to fix --- src/dlangui/platforms/console/consoleapp.d | 8 ++++++-- src/dlangui/platforms/console/dconsole.d | 10 +++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/dlangui/platforms/console/consoleapp.d b/src/dlangui/platforms/console/consoleapp.d index 06b7d8c1..16a98bfc 100644 --- a/src/dlangui/platforms/console/consoleapp.d +++ b/src/dlangui/platforms/console/consoleapp.d @@ -232,11 +232,15 @@ class ConsolePlatform : Platform { * When returned from this method, application is shutting down. */ override int enterMessageLoop() { + Log.i("Entered message loop"); while (_console.pollInput()) { - if (_windowList.length == 0) + if (_windowList.length == 0) { + Log.d("Window count is 0 - exiting message loop"); + break; + } } - // TODO + Log.i("Exiting from message loop"); return 0; } private dstring _clipboardText; diff --git a/src/dlangui/platforms/console/dconsole.d b/src/dlangui/platforms/console/dconsole.d index 56d82030..309f31e4 100644 --- a/src/dlangui/platforms/console/dconsole.d +++ b/src/dlangui/platforms/console/dconsole.d @@ -290,7 +290,15 @@ class Console { import core.stdc.errno; int res = cast(int)write(STDOUT_FILENO, s.ptr, s.length); if (res < 0) { - Log.e("rawWrite error ", errno, " - stopping terminal"); + auto err = errno; + while (err == EAGAIN) { + debug Log.d("rawWrite error EAGAIN - will retry"); + res = cast(int)write(STDOUT_FILENO, s.ptr, s.length); + if (res >= 0) + return (res > 0); + err = errno; + } + Log.e("rawWrite error ", err, " - stopping terminal"); _stopped = true; } return (res > 0);