From 87c712d64001f67ba6a9c04d9deedd0984b74131 Mon Sep 17 00:00:00 2001 From: Daniele Teti Date: Mon, 25 May 2020 15:18:32 +0200 Subject: [PATCH] Added procedure WaitForReturn in MVCFramework.Console.pas --- sources/MVCFramework.Console.pas | 6 ++++++ unittests/general/TestServer/TestServer.dpr | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sources/MVCFramework.Console.pas b/sources/MVCFramework.Console.pas index 15b5a938..bb412003 100644 --- a/sources/MVCFramework.Console.pas +++ b/sources/MVCFramework.Console.pas @@ -75,6 +75,7 @@ function GetConsoleSize: TMVCConsoleSize; function GetConsoleBufferSize: TMVCConsoleSize; procedure ClrScr; function GetCh: Char; +procedure WaitForReturn; function ColorName(const color: TConsoleColor): String; @@ -97,6 +98,11 @@ begin Result := GetEnumName(TypeInfo(TConsoleColor), Ord(color)); end; +procedure WaitForReturn; +begin + while GetCh <> #13 do; +end; + {$IFDEF LINUX} procedure Init; inline; begin diff --git a/unittests/general/TestServer/TestServer.dpr b/unittests/general/TestServer/TestServer.dpr index 330ce41b..df805618 100644 --- a/unittests/general/TestServer/TestServer.dpr +++ b/unittests/general/TestServer/TestServer.dpr @@ -65,7 +65,8 @@ begin http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdCustomTCPServer_ListenQueue.html } LServer.ListenQueue := 200; Writeln('Press RETURN to stop the server'); - ReadLn; + WaitForReturn; + TextColor(Red); Writeln('Server stopped'); ResetConsole(); finally