Merge pull request #4546 from reitermarkus/remove-macho-check

Remove `MachO` check for `Executable`.
This commit is contained in:
Markus Reiter 2018-07-25 10:28:35 +02:00 committed by GitHub
commit bfd82a3be1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,17 +1,9 @@
require_relative "uncompressed" require_relative "uncompressed"
require "vendor/macho/macho"
module UnpackStrategy module UnpackStrategy
class Executable < Uncompressed class Executable < Uncompressed
def self.can_extract?(path:, magic_number:) def self.can_extract?(path:, magic_number:)
return true if magic_number.match?(/\A#!\s*\S+/n) magic_number.match?(/\A#!\s*\S+/n)
begin
path.file? && MachO.open(path).header.executable?
rescue MachO::NotAMachOError
false
end
end end
end end
end end