Fix buffer_output to actually handle interrupts

pull/6/head
Karl Isenberg 2016-01-05 17:57:04 -08:00
parent acef0404e5
commit ff0a2871f3
1 changed files with 2 additions and 0 deletions

View File

@ -401,12 +401,14 @@ function cluster::mesos::docker::buffer_output {
local cmd="$@"
local tempfile="$(mktemp "${TMPDIR:-/tmp}/buffer.XXXXXX")"
trap "kill -TERM \${PID}; rm '${tempfile}'" TERM INT
set +e
${cmd} &> "${tempfile}" &
PID=$!
wait ${PID}
trap - TERM INT
wait ${PID}
local exit_status="$?"
set -e
if [ "${exit_status}" != 0 ]; then
cat "${tempfile}" 1>&2
fi