| ... | @@ -419,6 +419,19 @@ pub const InStream = struct { | ... | @@ -419,6 +419,19 @@ pub const InStream = struct { |
| 419 | } | 419 | } |
| 420 | } | 420 | } |
| 421 | | 421 | |
| | 422 | pub fn readLine(is: &InStream, buf: &Buffer) -> %void { |
| | 423 | %return buf.resize(0); |
| | 424 | |
| | 425 | while (true) { |
| | 426 | var byte: u8 = %return is.readByte(); |
| | 427 | %return buf.appendByte(byte); |
| | 428 | |
| | 429 | if (buf.endsWith(os.line_sep)) { |
| | 430 | break; |
| | 431 | } |
| | 432 | } |
| | 433 | } |
| | 434 | |
| 422 | pub fn isTty(self: &InStream) -> %bool { | 435 | pub fn isTty(self: &InStream) -> %bool { |
| 423 | if (is_posix) { | 436 | if (is_posix) { |
| 424 | if (builtin.link_libc) { | 437 | if (builtin.link_libc) { |