Parallels: skip missing paths when looking for unnecessary files
This commit is contained in:
parent
a23ab86226
commit
c6dba6c051
|
@ -29,6 +29,14 @@ func NewArtifact(dir string) (packer.Artifact, error) {
|
|||
files := make([]string, 0, 5)
|
||||
visit := func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
// It's possible that the path in question existed prior to visit being invoked, but has
|
||||
// since been deleted. This happens, for example, if you have the VM console open while
|
||||
// building. Opening the console creates a <vm name>.app directory which is gone by the time
|
||||
// visit is invoked, resulting in err being a "file not found" error. In this case, skip the
|
||||
// entire path and continue to the next one.
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return err
|
||||
}
|
||||
for _, unnecessaryFile := range unnecessaryFiles {
|
||||
|
|
Loading…
Reference in New Issue