Sha256: 1a964ad4f82693b2c7bf0684c7225ccd5edd2b0a78c988d87d90d389a52a3b08

Contents?: true

Size: 691 Bytes

Versions: 3

Compression:

Stored size: 691 Bytes

Contents

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 -a -o ppid= -o pid=`.lines
        candidates.select { |l| l =~ /^#{env.pid} / }
                  .map    { |l| l.split(" ").last   }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spring-0.0.10 lib/spring/client/status.rb
spring-0.0.9 lib/spring/client/status.rb
spring-0.0.8 lib/spring/client/status.rb