From a95996efb78be854bd141cdee45d9eeeabc8b1f8 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Fri, 6 Nov 2020 13:33:02 -0500 Subject: [PATCH] fix(macho): Silence the call to `codesign` (#283) Replaces `system` with `Open3.capture3` to collect `codesign`'s output and error streams. --- lib/macho.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/macho.rb b/lib/macho.rb index 16d3bd7e1..e8ab0dd19 100644 --- a/lib/macho.rb +++ b/lib/macho.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true -require "English" +require "open3" + require_relative "macho/structure" require_relative "macho/view" require_relative "macho/headers" @@ -52,10 +53,10 @@ def self.codesign!(filename) return if RUBY_PLATFORM !~ /darwin/ raise ArgumentError, "#{filename}: no such file" unless File.file?(filename) - system("codesign", "--sign", "-", "--force", - "--preserve-metadata=entitlements,requirements,flags,runtime", - filename) + _, _, status = Open3.capture3("codesign", "--sign", "-", "--force", + "--preserve-metadata=entitlements,requirements,flags,runtime", + filename) - raise CodeSigningError, "#{filename}: signing failed!" unless $CHILD_STATUS.success? + raise CodeSigningError, "#{filename}: signing failed!" unless status.success? end end