aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/container/executable.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/container/executable.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/container/executable.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/container/executable.rb b/Library/Homebrew/cask/lib/hbc/container/executable.rb
new file mode 100644
index 000000000..848f6d4be
--- /dev/null
+++ b/Library/Homebrew/cask/lib/hbc/container/executable.rb
@@ -0,0 +1,18 @@
+require "hbc/container/naked"
+require "vendor/macho/macho"
+
+module Hbc
+ class Container
+ class Executable < Naked
+ def self.me?(criteria)
+ return true if criteria.magic_number(/^#!\s*\S+/)
+
+ begin
+ MachO.open(criteria.path).header.executable?
+ rescue MachO::MagicError
+ false
+ end
+ end
+ end
+ end
+end