aboutsummaryrefslogtreecommitdiff
path: root/std/io.zig
diff options
context:
space:
mode:
Diffstat (limited to 'std/io.zig')
-rw-r--r--std/io.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/std/io.zig b/std/io.zig
index 93d50e6709..7b72af15e4 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;