Skip to content

Commit 702e310

Browse files
committed
Log failure to close and remove build directory
There is no real way to forward directory deletion errors when an execution has finished and a response has been sent. Therefore, print it as a log.
1 parent d03d5e3 commit 702e310

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/builder/local_build_executor.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package builder
22

33
import (
44
"context"
5+
"log"
56
"os"
67
"sync"
78
"time"
@@ -114,7 +115,11 @@ func (be *localBuildExecutor) CheckReadiness(ctx context.Context) error {
114115
if err != nil {
115116
return util.StatusWrap(err, "Failed to get build directory")
116117
}
117-
defer buildDirectory.Close()
118+
defer func() {
119+
if err := buildDirectory.Close(); err != nil {
120+
log.Printf("Failed to close build directory %s: %s", buildDirectoryPath.GetUNIXString(), err)
121+
}
122+
}()
118123

119124
// Create a useless directory inside the build directory. The
120125
// runner will validate that it exists.

0 commit comments

Comments
 (0)