Sha256: 7ee463a76317ac5a71b8832ac3d6fbc004114ad98c3981369bf0886420f7a149

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

module SpringStandalone
  module Client
    class Status < Command
      def self.description
        "Show current status."
      end

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

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

      def application_pids
        candidates = `ps -ax -o ppid= -o pid=`.lines
        candidates.select { |l| l =~ /^(\s+)?#{env.pid} / }
                  .map    { |l| l.split(" ").last   }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spring_standalone-0.1.13 lib/spring_standalone/client/status.rb