strip carriage return differently

This commit is contained in:
Folkert 2022-10-30 11:40:55 +01:00
parent 22e91e62c6
commit 7b449516ad
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 6 additions and 6 deletions

View file

@ -210,8 +210,8 @@ fn roc_fx_getInt_help() !i64 {
const stdin = std.io.getStdIn().reader();
var buf: [40]u8 = undefined;
const delimiter = if (builtin.os.tag == .windows) '\r' else '\n';
const line: []u8 = (try stdin.readUntilDelimiterOrEof(&buf, delimiter)) orelse "";
const raw_line: []u8 = (try stdin.readUntilDelimiterOrEof(&buf, '\n')) orelse "";
const line = std.mem.trimRight(u8, raw_line, &std.ascii.spaces);
return std.fmt.parseInt(i64, line, 10);
}