From 6ef7c83ec56d2dcc8c8af7a9e0004026abb070e0 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 25 Apr 2017 11:43:59 -0400 Subject: [PATCH] add data-loss warning to SIGINT handler in apply Warning user about data loss after receiving an interrupt. --- command/apply.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/command/apply.go b/command/apply.go index ca9813eb5..1e49739a0 100644 --- a/command/apply.go +++ b/command/apply.go @@ -201,7 +201,7 @@ func (c *ApplyCommand) Run(args []string) int { ctxCancel() // Notify the user - c.Ui.Output("Interrupt received. Gracefully shutting down...") + c.Ui.Output(outputInterrupt) // Still get the result, since there is still one select { @@ -418,3 +418,7 @@ func outputsAsString(state *terraform.State, modPath []string, schema []*config. return strings.TrimSpace(outputBuf.String()) } + +const outputInterrupt = `Interrupt received. +Please wait for Terraform to exit or data loss may occur. +Gracefully shutting down...`