From 0ba80c88e86f2adca4f557522aa4e3395ad01852 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 3 Jun 2013 15:31:28 -0700 Subject: [PATCH] packer/plugin: Implement Builder.Cancel --- packer/plugin/builder.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packer/plugin/builder.go b/packer/plugin/builder.go index b1a6855e5..5113b459c 100644 --- a/packer/plugin/builder.go +++ b/packer/plugin/builder.go @@ -32,6 +32,12 @@ func (b *cmdBuilder) Run(ui packer.Ui, hook packer.Hook) packer.Artifact { } func (b *cmdBuilder) Cancel() { + defer func() { + r := recover() + b.checkExit(r, nil) + }() + + b.builder.Cancel() } func (c *cmdBuilder) checkExit(p interface{}, cb func()) {