lib/clamby/command.rb in clamby-1.6.2 vs lib/clamby/command.rb in clamby-1.6.5

- old
+ new

@@ -21,10 +21,14 @@ if Clamby.config[:daemonize] args << '--fdpass' if Clamby.config[:fdpass] args << '--stream' if Clamby.config[:stream] end + puts "use db : #{Clamby.config[:datadir]}" + args << "-d #{Clamby.config[:datadir]}" if Clamby.config[:datadir] + puts args.join(' ') + new.run scan_executable, *args # $CHILD_STATUS maybe nil if the execution itself (not the client process) # fails case $CHILD_STATUS && $CHILD_STATUS.exitstatus @@ -33,11 +37,11 @@ when nil, 2 # clamdscan returns 2 whenever error other than a detection happens if Clamby.config[:error_clamscan_client_error] && Clamby.config[:daemonize] raise Clamby::ClamscanClientError.new("Clamscan client error") end - + # returns true to maintain legacy behavior return true else return true unless Clamby.config[:error_file_virus] @@ -45,11 +49,13 @@ end end # Update the virus definitions. def self.freshclam - new.run 'freshclam' + args = [] + args << "--datadir=#{Clamby.config[:datadir]}" if Clamby.config[:datadir] + new.run 'freshclam', *args end # Show the ClamAV version. Also acts as a quick check if ClamAV functions. def self.clamscan_version new.run scan_executable, '--version' @@ -66,10 +72,10 @@ def run(executable, *args) executable_full = executable_path(executable) self.command = args | default_args self.command = command.sort.unshift(executable_full) - system(*self.command, system_options) + system(self.command.join(' '), system_options) end private def default_args