Skip to content
Snippets Groups Projects
Unverified Commit 09d7889e authored by Claudia's avatar Claudia
Browse files

Extract constant IO_DEFAULT_BUFFER_SIZE

parent 246db8a1
No related branches found
No related tags found
No related merge requests found
# frozen_string_literal: true
module Utils
IO_DEFAULT_BUFFER_SIZE = 4096
private_constant :IO_DEFAULT_BUFFER_SIZE
def self.popen_read(*args, **options, &block)
popen(args, "rb", options, &block)
end
......@@ -18,7 +21,7 @@ module Utils
# Before we yield to the block, capture as much output as we can
loop do
output += pipe.read_nonblock(4096)
output += pipe.read_nonblock(IO_DEFAULT_BUFFER_SIZE)
rescue IO::WaitReadable, EOFError
break
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment