add data-loss warning to SIGINT handler in apply

Warning user about data loss after receiving an interrupt.
This commit is contained in:
James Bardin 2017-04-25 11:43:59 -04:00
parent 7a07c4e99c
commit 6ef7c83ec5
1 changed files with 5 additions and 1 deletions

View File

@ -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...`