From 3262842e0adaed63935923bdc14884ac19d7549c Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Tue, 13 Dec 2022 00:22:57 -0800 Subject: Skip calling f.read for `overwrite: true`-only cases We only need to set outpath for that case. --- tool/lib/output.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tool') diff --git a/tool/lib/output.rb b/tool/lib/output.rb index a7faa44810..51e3d32010 100644 --- a/tool/lib/output.rb +++ b/tool/lib/output.rb @@ -30,8 +30,10 @@ class Output if (@ifchange or overwrite or create_only) and (@vpath.open(@path, "rb") {|f| outpath = f.path - original = f.read - (@ifchange and original == data) or (create_only and !original.empty?) + if @ifchange or create_only + original = f.read + (@ifchange and original == data) or (create_only and !original.empty?) + end } rescue false) puts "#{outpath} #{unchanged}" written = false -- cgit v1.2.3