summaryrefslogtreecommitdiff
path: root/lib/shell/command-processor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/shell/command-processor.rb')
-rw-r--r--lib/shell/command-processor.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/shell/command-processor.rb b/lib/shell/command-processor.rb
index f52d0ead6d..8a9ab55e73 100644
--- a/lib/shell/command-processor.rb
+++ b/lib/shell/command-processor.rb
@@ -369,7 +369,12 @@ class Shell
for p in @shell.system_path
path = join(p, command)
- if FileTest.exist?(path)
+ begin
+ st = File.stat(path)
+ rescue SystemCallError
+ next
+ else
+ next unless st.executable? and !st.directory?
@system_commands[command] = path
return path
end