]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.tools.listener: fix stream-read-unsafe
authorJoe Groff <arcata@gmail.com>
Thu, 13 Oct 2011 21:51:16 +0000 (14:51 -0700)
committerJoe Groff <arcata@gmail.com>
Tue, 18 Oct 2011 04:23:05 +0000 (21:23 -0700)
It was returning the number of requested bytes even if eof was encountered.

basis/ui/tools/listener/listener.factor

index 2829c214e249e58a133620f94f0ed0ac1127afe2..4710b29c71813d41b341723468c9bc854e0317eb 100644 (file)
@@ -152,8 +152,9 @@ M: interactor stream-readln
 
 M:: interactor stream-read-unsafe ( n buf interactor -- count )
     n [ 0 ] [
+        drop
         interactor interactor-read dup [ "\n" join ] when
-        n short head-slice 0 buf copy
+        n short [ head-slice 0 buf copy ] keep
     ] if-zero ;
 
 M: interactor stream-read-partial-unsafe