Skip to content

Commit

Permalink
fix(macho): Silence the call to codesign (#283)
Browse files Browse the repository at this point in the history
Replaces `system` with `Open3.capture3` to collect `codesign`'s
output and error streams.
  • Loading branch information
woodruffw authored Nov 6, 2020
1 parent b4953e0 commit a95996e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/macho.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "English"
require "open3"

require_relative "macho/structure"
require_relative "macho/view"
require_relative "macho/headers"
Expand Down Expand Up @@ -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

0 comments on commit a95996e

Please sign in to comment.