diff --git a/provisioner/shell/provisioner.go b/provisioner/shell/provisioner.go index 65a537055..fa3e73351 100644 --- a/provisioner/shell/provisioner.go +++ b/provisioner/shell/provisioner.go @@ -193,6 +193,11 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) { ui.Message(strings.TrimSpace(output)) case exitStatus := <-exitChan: log.Printf("shell provisioner exited with status %d", exitStatus) + + if exitStatus != 0 { + ui.Error(fmt.Sprintf("Script excited with non-zero exit status: %d", exitStatus)) + } + break OutputLoop } }