Ctrl-Z in windows and byLine()

Jay Norwood jayn at prismnet.com
Wed Oct 12 19:30:20 PDT 2011


I stepped through in the debugger and here is what I noted:
1.in response to ctrl-z on the first line, stdin.byLine() call to popFront() executes file.detach due to 0 length line returned by file.readln().

2.  surprisingly (to me), the first foreach enters the loop even though there is a 0 length line.

3. in the inner foreach statement, strip returns 0 length line.
4. during the next iteration of  outer foreach,  during stdin.byLine()  bailOut occurs in popFront() on the enforce(file.isOpen) ... makes sense.

So ... looks to me like the error is whatever is allowing execution to enter the outer foreach loop when line.length is 0 and the eof is true on return from byLine().    





More information about the Digitalmars-d mailing list