Skip to content

Commit 804e83e

Browse files
committed
fix: report error if failed to remove layer
Signed-off-by: Gavin Zhao <[email protected]>
1 parent e44ffa8 commit 804e83e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

builder/layer.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ func (l *Layer) RequestOverlay(notif PidNotifier) (contentPath string, err error
7171
}
7272
}
7373

74-
func (l *Layer) RemoveIfNotCreated() {
74+
func (l *Layer) RemoveIfNotCreated() error {
7575
if !l.created {
7676
slog.Info("Removing incomplete layer", "path", l.BasePath())
77-
os.RemoveAll(l.BasePath())
77+
return os.RemoveAll(l.BasePath())
78+
} else {
79+
return nil
7880
}
7981
}
8082

builder/manager.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,9 @@ func (m *Manager) Cleanup() {
321321

322322
// Remove the layer if it's unfinished
323323
if m.layer != nil {
324-
m.layer.RemoveIfNotCreated()
324+
if err := m.layer.RemoveIfNotCreated(); err != nil {
325+
slog.Error("Failure in cleaning incomplete layer", "err", err)
326+
}
325327
}
326328

327329
// Finally clean out the lock files

0 commit comments

Comments
 (0)