lib/clamby/command.rb in clamby-1.5.0 vs lib/clamby/command.rb in clamby-1.5.1

- old
+ new

@@ -19,11 +19,11 @@ args = [path, '--no-summary'] if Clamby.config[:daemonize] args << '--fdpass' if Clamby.config[:fdpass] args << '--stream' if Clamby.config[:stream] - args << "--config-file=#{Clamby.config[:config_file]}" if Clamby.config[:config_file] && Clamby.config[:daemonize] + args << "--config-file=#{Clamby.config[:config_file]}" if Clamby.config[:config_file] end new.run scan_executable, *args case $CHILD_STATUS.exitstatus @@ -61,13 +61,13 @@ # # Examples: # run('clamscan', file, '--verbose') # run('clamscan', '-V') def run(executable, *args) - raise "`#{executable}` is not permitted" unless EXECUTABLES.include?(executable) + executable_full = executable_path(executable) self.command = args | default_args - self.command = command.sort.unshift(executable) + self.command = command.sort.unshift(executable_full) system(*self.command, system_options) end private @@ -84,9 +84,14 @@ if Clamby.config[:output_level] == 'off' { out: File::NULL } else {} end + end + + def executable_path(executable) + raise "`#{executable}` is not permitted" unless EXECUTABLES.include?(executable) + Clamby.config[:"executable_path_#{executable}"] end def self.file_exists?(path) return true if File.file?(path)