Pull Requests | Issues | v4.4.0...v4.4.1
Fixes
#795 Propagate the signal such as SIGINT to terraform command properly for graceful shutdown
exec.CommandContext exits a command by SIGKILL immediately, so the command can't exit gracefully. So let's use suzuki-shunsuke/go-timeout instead.
go-timeout exits a command by SIGINT gracefully.
Reference
Test
hello.sh
#!/usr/bin/env bash
set -eu
set -o pipefail
trap 'echo trapped.' 2
sleep 60
AS IS
$ tfcmt -v
tfcmt version 4.4.0 (5e9bc7fece716d7e892b273c1a7a2103273a7f9c)
$ tfcmt plan -- bash hello.sh
^CERRO[0002] remove labels error="context canceled" program=tfcmt
context canceled
echo trapped.
isn't executed.
TO BE
$ tfcmt plan -- bash hello.sh
^Ctrapped.
ERRO[0001] remove labels error="context canceled" program=tfcmt
context canceled
echo trapped.
is executed.