summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatt Wrock <matt@mattwrock.com>2015-09-11 15:04:02 -0700
committerMatt Wrock <matt@mattwrock.com>2015-09-11 15:04:02 -0700
commit8446b81929d3a1c3ef2dd24d5d93802add1791dc (patch)
tree28038822e052d37a479da8cf5f58f182b2ae12cd /lib
parentaad254180a12abc1847a1f0c52a43d947e301031 (diff)
downloadmixlib-shellout-8446b81929d3a1c3ef2dd24d5d93802add1791dc.tar.gz
prevent shellout from attempting to execute a directory on windows
Diffstat (limited to 'lib')
-rw-r--r--lib/mixlib/shellout/windows.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/mixlib/shellout/windows.rb b/lib/mixlib/shellout/windows.rb
index bcda96a..6003ae8 100644
--- a/lib/mixlib/shellout/windows.rb
+++ b/lib/mixlib/shellout/windows.rb
@@ -301,14 +301,18 @@ module Mixlib
# The OS will search through valid the extensions and look
# for a binary there.
def self.find_executable(path)
- return path if File.executable? path
+ return path if executable? path
pathext.each do |ext|
exe = "#{path}#{ext}"
- return exe if File.executable? exe
+ return exe if executable? exe
end
return nil
end
+
+ def self.executable?(path)
+ File.executable?(path) && !File.directory?(path)
+ end
end
end # class
end