mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
11 lines
242 B
Ruby
11 lines
242 B
Ruby
![]() |
class IO
|
||
|
def readline_nonblock(sep = $INPUT_RECORD_SEPARATOR)
|
||
|
buffer = ""
|
||
|
buffer.concat(read_nonblock(1)) while buffer[-1] != sep
|
||
|
buffer
|
||
|
rescue IO::WaitReadable, EOFError => e
|
||
|
raise e if buffer.empty?
|
||
|
buffer
|
||
|
end
|
||
|
end
|