mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-23 14:35:12 +00:00
strip carriage return differently
This commit is contained in:
parent
22e91e62c6
commit
7b449516ad
3 changed files with 6 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue