From 09d7889ed8f6eee000c523a7ada42b850ec64e04 Mon Sep 17 00:00:00 2001 From: Claudia <claui@users.noreply.github.com> Date: Wed, 2 Sep 2020 18:14:56 +0200 Subject: [PATCH] Extract constant IO_DEFAULT_BUFFER_SIZE --- Library/Homebrew/utils/popen.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/popen.rb b/Library/Homebrew/utils/popen.rb index 18cd057fe8..eac4823c64 100644 --- a/Library/Homebrew/utils/popen.rb +++ b/Library/Homebrew/utils/popen.rb @@ -1,6 +1,9 @@ # 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 -- GitLab