mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
reporting if command got killed by a signal.
This commit is contained in:
parent
b1e2c2387c
commit
10f2a19f08
2 changed files with 18 additions and 1 deletions
|
@ -243,6 +243,13 @@ module Capistrano
|
|||
ch[:status] = data.read_long
|
||||
end
|
||||
|
||||
channel.on_request("exit-signal") do |ch, data|
|
||||
if logger
|
||||
exit_signal = data.read_string
|
||||
logger.important "command received signal #{exit_signal}", ch[:server]
|
||||
end
|
||||
end
|
||||
|
||||
channel.on_close do |ch|
|
||||
ch[:closed] = true
|
||||
end
|
||||
|
|
|
@ -154,6 +154,16 @@ class CommandTest < Test::Unit::TestCase
|
|||
assert_equal 5, channel[:status]
|
||||
end
|
||||
|
||||
def test_on_request_should_log_exit_signal_if_logger_present
|
||||
data = mock(:read_string => "TERM")
|
||||
logger = stub_everything
|
||||
|
||||
session = setup_for_extracting_channel_action([:on_request, "exit-signal"], data)
|
||||
logger.expects(:important).with("command received signal TERM", server("capistrano"))
|
||||
|
||||
Capistrano::Command.new("puppet", [session], :logger => logger)
|
||||
end
|
||||
|
||||
def test_on_close_should_set_channel_closed
|
||||
channel = nil
|
||||
session = setup_for_extracting_channel_action(:on_close) { |ch| channel = ch }
|
||||
|
|
Loading…
Reference in a new issue