packer: closed pipe is caught [GH-875]

This commit is contained in:
Mitchell Hashimoto 2014-02-21 17:43:45 -08:00
parent 868a64ebbc
commit 1c65536514
2 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,8 @@ BUG FIXES:
* core: Fix crash case if blank parameters are given to Packer. [GH-832]
* core: Fix crash if big file uploads are done. [GH-897]
* core: Fix crash if machine-readable output is going to a closed
pipe. [GH-875]
* builder/docker: user variables work properly. [GH-777]
* builder/qemu: reboots are now possible in provisioners. [GH-864]
* builder/virtualbox,vmware: iso\_checksum is not required if the

View File

@ -11,6 +11,7 @@ import (
"runtime"
"strings"
"sync"
"syscall"
"time"
"unicode"
)
@ -282,6 +283,11 @@ func (u *MachineReadableUi) Machine(category string, args ...string) {
_, err := fmt.Fprintf(u.Writer, "%d,%s,%s,%s\n", now.Unix(), target, category, argsString)
if err != nil {
panic(err)
if err == syscall.EPIPE {
// Ignore epipe errors because that just means that the file
// is probably closed or going to /dev/null or something.
} else {
panic(err)
}
}
}