mirror of https://github.com/markbates/pkger.git
remove out file if packing panics
This commit is contained in:
parent
7ee0500044
commit
8879dba851
|
@ -125,6 +125,11 @@ func (e *packCmd) Flags() *flag.FlagSet {
|
||||||
|
|
||||||
func Package(out string, decls parser.Decls) error {
|
func Package(out string, decls parser.Decls) error {
|
||||||
os.RemoveAll(out)
|
os.RemoveAll(out)
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
os.RemoveAll(out)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
f, err := os.Create(out)
|
f, err := os.Create(out)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue