<commit_before>class Specinfra::Helper::DetectOs::Debian < Specinfra::Helper::DetectOs
  def self.detect
    if run_command('ls /etc/debian_version').success?
      lsb_release = run_command("lsb_release -ir")
      if lsb_release.success?
        if lsb_release.stdout =~ /:/
          distro = lsb_release.stdout.split("\n").first.split(':').last
          release = lsb_release.stdout.split("\n").last.split(':').last.strip
        end
      else
        lsb_release = run_command("cat /etc/lsb-release")
        if lsb_release.success?
          lsb_release.stdout.each_line do |line|
            distro = line.split('=').last if line =~ /^DISTRIB_ID=/
            release = line.split('=').last.strip if line =~ /^DISTRIB_RELEASE=/
          end
        end
      end
      distro ||= 'debian'
      release ||= nil
      { :family => distro.strip.downcase, :release => release }
    end
  end
end<commit_msg>Fix debian detection routine<commit_after>class Specinfra::Helper::DetectOs::Debian < Specinfra::Helper::DetectOs
  def self.detect
    if run_command('ls /etc/debian_version').success?
      distro  = nil
      release = nil
      lsb_release = run_command("lsb_release -ir")
      if lsb_release.success?
        lsb_release.stdout.each_line do |line|
          distro  = line.split(':').last.strip if line =~ /^Distributor ID:/
          release = line.split(':').last.strip if line =~ /^Release:/
        end
      else
        lsb_release = run_command("cat /etc/lsb-release")
        if lsb_release.success?
          lsb_release.stdout.each_line do |line|
            distro  = line.split('=').last.strip if line =~ /^DISTRIB_ID=/
            release = line.split('=').last.strip if line =~ /^DISTRIB_RELEASE=/
          end
        end
      end
      distro ||= 'debian'
      release ||= nil
      { :family => distro.strip.downcase, :release => release }
    end
  end
end
{'fraction_non_alphanumeric': 0.13811280969952558, 'fraction_numerical': 0.0, 'mean_word_length': 2.377224199288256, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5382601', 'n_tokens_mistral': 626, 'n_tokens_neox': 600, 'n_words': 120}