From 50fef50e4be908929daf5b917e95e48119678792 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 8 Jun 2015 21:28:36 -0700 Subject: [PATCH] add interrupt handling for SIGTERM [GH-1858] --- CHANGELOG.md | 1 + signal.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c30477e5..fb3d26c5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ FEATURES: IMPROVEMENTS: + * core: Interrupt handling for SIGTERM signal as well. [GH-1858] * builder/openstack: Add `rackconnect_wait` for Rackspace customers to wait for RackConnect data to appear * buidler/openstakc: Add `ssh_interface` option for rackconnect for users that diff --git a/signal.go b/signal.go index 99c9d4c73..8846a3451 100644 --- a/signal.go +++ b/signal.go @@ -4,6 +4,7 @@ import ( "log" "os" "os/signal" + "syscall" "github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer/plugin" @@ -14,6 +15,7 @@ import ( func setupSignalHandlers(ui packer.Ui) { ch := make(chan os.Signal, 1) signal.Notify(ch, os.Interrupt) + signal.Notify(ch, syscall.SIGTERM) go func() { // First interrupt. We mostly ignore this because it allows the