Actions
Bug #18767
closedIO.foreach hangs up when passes limit=0
Description
IO.foreach
behaves in an unexpected way in a corner case when passes 0 as a limit parameter. It never stops and hangs up.
IO.foreach('file.txt', 0) { |s| p s }
""
""
""
""
""
""
""
""
""
""
Expected behavior - to raise ArgumentError "invalid limit: 0" like it does the IO.readlines
method.
I observe this behavior on 2.6, 2.7, and 3.0. Didn't check on 3.1 and master though.
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0