Sha256: 3cab3037d7a73073865013e5b1784470f914a8208c4a766a92a5674fed85926f

Contents?: true

Size: 763 Bytes

Versions: 20

Compression:

Stored size: 763 Bytes

Contents

# encoding: utf-8
module TestServer
  module Actions
    class SendSignal
      private

      attr_reader :signal, :pid_file, :signalizer

      public

      def initialize(signal, pid_file = TestServer.config.pid_file, signalizer = Process)
        @signal     = signal
        @pid_file   = pid_file
        @signalizer = signalizer
      end

      def run
        signalizer.kill signal, pid
      rescue Exceptions::PidFileDoesNotExist
        TestServer.ui_logger.error "Pid-file \"#{pid_file}\" does not exist. I'm not able to send daemon signal \"#{signal}\"."
      end

      private

      def pid
        ::File.read(pid_file).to_i
      rescue Errno::ENOENT => e
        raise Exceptions::PidFileDoesNotExist, e.message
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
test_server-0.5.2 lib/test_server/actions/send_signal.rb
test_server-0.5.1 lib/test_server/actions/send_signal.rb
test_server-0.5.0 lib/test_server/actions/send_signal.rb
test_server-0.4.1 lib/test_server/actions/send_signal.rb
test_server-0.4.0 lib/test_server/actions/send_signal.rb
test_server-0.3.7 lib/test_server/actions/send_signal.rb
test_server-0.3.6 lib/test_server/actions/send_signal.rb
test_server-0.3.5 lib/test_server/actions/send_signal.rb
test_server-0.3.4 lib/test_server/actions/send_signal.rb
test_server-0.3.2 lib/test_server/actions/send_signal.rb
test_server-0.3.1 lib/test_server/actions/send_signal.rb
test_server-0.2.4 lib/test_server/actions/send_signal.rb
test_server-0.2.3 lib/test_server/actions/send_signal.rb
test_server-0.2.2 lib/test_server/actions/send_signal.rb
test_server-0.2.1 lib/test_server/actions/send_signal.rb
test_server-0.2.0 lib/test_server/actions/send_signal.rb
test_server-0.1.2 lib/test_server/actions/send_signal.rb
test_server-0.1.1 lib/test_server/actions/send_signal.rb
test_server-0.1.0 lib/test_server/actions/send_signal.rb
test_server-0.0.11 lib/test_server/actions/send_signal.rb