<commit_before>module Spring
  module Client
    class Status < Command
      def self.description
        "Show current status."
      end

      def call
        if env.server_running?
          puts "Spring is running:"
          puts
          puts `ps -p #{env.pid} --ppid #{env.pid} -o pid= -o cmd=`
        else
          puts "Spring is not running."
        end
      end
    end
  end
end<commit_msg>Implement status command in a more portable way<commit_after>module Spring
  module Client
    class Status < Command
      def self.description
        "Show current status."
      end

      def call
        if env.server_running?
          puts "Spring is running:"
          puts
          print_process env.pid
          application_pids.each { |pid| print_process pid }
        else
          puts "Spring is not running."
        end
      end

      def print_process(pid)
        puts `ps -p #{pid} -o pid= -o args=`
      end

      def application_pids
        candidates = `ps -o ppid= -o pid=`.lines
        candidates.select { |l| l =~ /^#{env.pid} / }
                  .map    { |l| l.split(" ").last   }
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08635578583765112, 'fraction_numerical': 0.0, 'mean_word_length': 1.5305676855895196, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7120682', 'n_tokens_mistral': 336, 'n_tokens_neox': 340, 'n_words': 116}