<commit_before>module VirusScanService
  class KasperskyRunner
    class LinuxExecutor
      # not tested on real production as I'm using windows VM for virus scans
      def scan(file_path, log_path)
        system 'sudo',
          '/opt/kaspersky/kes4lwks/bin/kes4lwks-control',
          '--scan-file',
          file_path.to_s,
          ">>",
          log_path.to_s
      end
    end
  end
end<commit_msg>Fix linux executer -- output redirection to file<commit_after>require 'open3'
module VirusScanService
  class KasperskyRunner
    class LinuxExecutor
      def scan(file_path, log_path)
	stdout, stderr, status = Open3.capture3(
         "sudo /opt/kaspersky/kes4lwks/bin/kes4lwks-control --scan-file #{file_path.to_s}"
        )
        File.open(log_path.to_s, 'w') { |file| file.write(stdout) }
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09449760765550239, 'fraction_numerical': 0.008373205741626795, 'mean_word_length': 2.5466101694915255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5828633', 'n_tokens_mistral': 286, 'n_tokens_neox': 279, 'n_words': 64}