Do not panic on permission denied

Replace panic with FATAL logging and graceful shutdown.

Fixes #837
This commit is contained in:
bep 2015-01-27 16:51:24 +01:00
parent 8ad4fd05d8
commit 251f5e9d40

View file

@ -17,6 +17,7 @@ import (
"errors"
"fmt"
"github.com/spf13/afero"
jww "github.com/spf13/jwalterweatherman"
"github.com/spf13/viper"
"io"
"os"
@ -391,7 +392,7 @@ func WriteToDisk(inpath string, r io.Reader, fs afero.Fs) (err error) {
err = fs.MkdirAll(ospath, 0777) // rwx, rw, r
if err != nil {
if err != os.ErrExist {
panic(err)
jww.FATAL.Fatalln(err)
}
}
}