Skip to content

Commit 9090c3a

Browse files
committed
fix: check build directory exists before deletion
1 parent 4fbf41a commit 9090c3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/common/src/task/build-function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class BuildFunctionTask extends Task<ContainerImage> {
110110
await fs.promises.unlink(`./${contextBuildDirectory}/${imageId}.toml`);
111111

112112
// remove build directory if empty
113-
if (fs.readdirSync(contextBuildDirectory).length === 0) {
113+
if (fs.existsSync(contextBuildDirectory) && fs.readdirSync(contextBuildDirectory).length === 0) {
114114
await fs.promises.rmdir(contextBuildDirectory);
115115
}
116116
} catch (e) {

0 commit comments

Comments
 (0)