diff --git a/builder/virtualbox/builder.go b/builder/virtualbox/builder.go index 4bbc04b1e..ea2e7de68 100644 --- a/builder/virtualbox/builder.go +++ b/builder/virtualbox/builder.go @@ -260,6 +260,15 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe return nil, rawErr.(error) } + // If we were interrupted or cancelled, then just exit. + if _, ok := state[multistep.StateCancelled]; ok { + return nil, errors.New("Build was cancelled.") + } + + if _, ok := state[multistep.StateHalted]; ok { + return nil, errors.New("Build was halted.") + } + // Compile the artifact list files := make([]string, 0, 5) visit := func(path string, info os.FileInfo, err error) error {