Module: DeepTest::Demon

Included in:
Agent, DeepTest::Distributed::Beachhead
Defined in:
lib/deep_test/demon.rb

Instance Method Summary collapse

Instance Method Details

#execute(*args) ⇒ Object



21
22
23
# File 'lib/deep_test/demon.rb', line 21

def execute(*args)
  raise "#{self.class} must implement the execute method to be a Demon"
end

#forked(name, options, demon_args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/deep_test/demon.rb', line 3

def forked(name, options, demon_args)
  options.connect_to_central_command do |wire|
    ProxyIO.replace_stdout_stderr!(wire) do
      begin
        catch(:exit_demon) do
          Signal.trap("TERM") { throw :exit_demon }
          execute *demon_args
        end
      rescue SystemExit => e
        raise
      rescue Exception => e
        FailureMessage.show self.class.name, "Process #{Process.pid} exiting with excetion: #{e.class}: #{e.message}"
        raise
      end
    end
  end
end