mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
18 lines
371 B
Ruby
18 lines
371 B
Ruby
![]() |
require_relative "uncompressed"
|
||
|
|
||
|
require "vendor/macho/macho"
|
||
|
|
||
|
module UnpackStrategy
|
||
|
class Executable < Uncompressed
|
||
|
def self.can_extract?(path:, magic_number:)
|
||
|
return true if magic_number.match?(/\A#!\s*\S+/n)
|
||
|
|
||
|
begin
|
||
|
path.file? && MachO.open(path).header.executable?
|
||
|
rescue MachO::NotAMachOError
|
||
|
false
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|