Index: trunk/ab5.0/ablib/src/Classes/System/Console.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/System/Console.ab	(revision 706)
+++ trunk/ab5.0/ablib/src/Classes/System/Console.ab	(revision 707)
@@ -691,18 +691,28 @@
 Protected
 	Override Function Underflow() As Boolean
-		Dim b = Buffer
-		Dim currentBufLength = b.Length
-		b.Length = currentBufLength + 256
-		Dim p = StrPtr(b)
-		Dim read As DWord
-		If ReadConsole(h, VarPtr(p[currentBufLength]), 256 * SizeOf (TCHAR), read, 0) = 0 Then
-			IO.Detail.ThrowWinLastErrorIOException()
-		End If
-		b.Length = currentBufLength + read
-		Underflow = read <> 0
+		If eofReached Then
+			Underflow = 0
+		Else
+			Dim b = Buffer
+			Dim currentBufLength = b.Length
+			b.Length = currentBufLength + 256
+			Dim p = StrPtr(b)
+			Dim read As DWord
+			If ReadConsole(h, VarPtr(p[currentBufLength]), 256 * SizeOf (TCHAR), read, 0) = 0 Then
+				IO.Detail.ThrowWinLastErrorIOException()
+			End If
+			Dim eofPos = ActiveBasic.Strings.ChrFind(VarPtr(p[currentBufLength]) As PCTSTR, read As SIZE_T, &h1A As TCHAR)
+			If eofPos <> -1 Then
+				eofReached = True
+				read = eofPos
+			End If
+			b.Length = currentBufLength + read
+			Underflow = read <> 0
+		End If
 	End Function
 
 Private
 	h As HANDLE
+	eofReached As Boolean
 End Class
 
