diff --git a/std/io.zig b/std/io.zig index 93d50e67096766a1667c6edc72ffddadc2119b8c..7b72af15e439ff763b1b42f29e30be0c614a1f47 100644 --- a/std/io.zig +++ b/std/io.zig @@ -486,6 +486,11 @@ pub fn readLine(buf: []u8) !usize { while (true) { const byte = stream.readByte() catch return error.EndOfFile; switch (byte) { + '\r' => { + // trash the following \n + _ = stream.readByte() catch return error.EndOfFile; + return index; + }, '\n' => return index, else => { if (index == buf.len) return error.InputTooLong;