| ... | @@ -486,6 +486,11 @@ pub fn readLine(buf: []u8) !usize { | ... | @@ -486,6 +486,11 @@ pub fn readLine(buf: []u8) !usize { |
| 486 | while (true) { | 486 | while (true) { |
| 487 | const byte = stream.readByte() catch return error.EndOfFile; | 487 | const byte = stream.readByte() catch return error.EndOfFile; |
| 488 | switch (byte) { | 488 | switch (byte) { |
| | 489 | '\r' => { |
| | 490 | // trash the following \n |
| | 491 | _ = stream.readByte() catch return error.EndOfFile; |
| | 492 | return index; |
| | 493 | }, |
| 489 | '\n' => return index, | 494 | '\n' => return index, |
| 490 | else => { | 495 | else => { |
| 491 | if (index == buf.len) return error.InputTooLong; | 496 | if (index == buf.len) return error.InputTooLong; |