From 67c619d4f28b27ba9e33fadc149123fe237df4a1 Mon Sep 17 00:00:00 2001 From: XuehaiPan Date: Mon, 8 Nov 2021 20:10:30 +0800 Subject: [PATCH] style: use popen_write to apply patches --- Library/Homebrew/style.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index fdef92b300..3375ba3116 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -181,8 +181,9 @@ module Homebrew ] if fix - patch = system_command shellcheck, args: ["--format=diff", *args] - system_command "patch", args: ["-d", "/", "-p0"], input: patch.stdout + patches = system_command(shellcheck, args: ["--format=diff", *args]).stdout + patch_command = %w[patch -g 0 -f -d / -p0] + Utils.popen_write(*patch_command) { |p| p.write(patches) } end case output_type