standardize panic output

Programs that monitor Terraform's output to report panics might
make the reasonable assumption that the string "panic:" is always
included and is therefore safe to monitor for. Our custom panic
output unfortunately breaks these assumptions at the moment.

Instead of asking consumers to add their own handling to deal with
this problem, let's add that greppable string to our custom panic
output.
radditude/standard-panics
CJ Horton 2 years ago
parent e6665c4f43
commit 6e1e00ae3f

@ -78,7 +78,7 @@ func PanicHandler() {
stderr = os.Stderr
}
fmt.Fprint(stderr, panicOutput)
fmt.Fprint(stderr, recovered, "\n")
fmt.Fprint(stderr, "panic: ", recovered, "\n")
// The following mimics the implementation of debug.PrintStack, but
// without the hard-coded reference to os.Stderr.
stderr.Write(debug.Stack())

Loading…
Cancel
Save