APIdock / Ruby
/
method

find_system_command

ruby latest stable - Class: Shell ::CommandProcessor
find_system_command(command)
public

private functions

# File lib/shell/command-processor.rb, line 356
 def find_system_command(command)
 return command if /^\// =~ command
 case path = @system_commands[command]
 when String
 if exists?(path)
 return path
 else
 Shell.Fail Error::CommandNotFound, command
 end
 when false
 Shell.Fail Error::CommandNotFound, command
 end
 for p in @shell.system_path
 path = join(p, command)
 begin
 st = File.stat(path)
 rescue SystemCallError
 next
 else
 next unless st.executable? and !st.directory?
 @system_commands[command] = path
 return path
 end
 end
 @system_commands[command] = false
 Shell.Fail Error::CommandNotFound, command
 end

AltStyle によって変換されたページ (->オリジナル) /