capistrano/capistrano — pull request #363 by tanob (2013-01-20 19:01:56+00:00)
Title: Report if command got killed by a signal

Spent one hour another day investigating why a Puppet run via Capistrano on some servers failed. In the end found out the command got killed by a left over hourly cron job that used to kill existing Puppet processes.

Before the pull request if the invoked command gets killed by a signal there's no report in the output:
```shell
$> ROLES=jobs USER=root cap qa COMMAND="sleep 60" invoke
triggering load callbacks
* 2013-01-20 16:37:06 executing `qa'
triggering start callbacks for `invoke'
* 2013-01-20 16:37:06 executing `multistage:ensure'
* 2013-01-20 16:37:06 executing `invoke'
* executing "sleep 60"
servers: ["vm100-017"]
[vm100-017] executing command
command finished in 8958ms
failed: "sh -c 'sleep 60'" on vm100-017
```

After the pull request:
```shell
$> ROLES=jobs USER=root cap qa COMMAND="sleep 60" invoke
triggering load callbacks
* 2013-01-20 16:40:18 executing `qa'
triggering start callbacks for `invoke'
* 2013-01-20 16:40:18 executing `multistage:ensure'
* 2013-01-20 16:40:18 executing `invoke'
* executing "sleep 60"
servers: ["vm100-017"]
[vm100-017] executing command
*** [vm100-017] command received signal TERM
command finished in 8421ms
failed: "sh -c 'sleep 60'" on vm100-017
```

This will, at least, give some idea to the user on why the command failed.