Skip to content

Commit 1623eaf

Browse files
authored
Merge pull request #231 from nitrictech/fix/race-condition-clean
fix: check build directory exists before deletion
2 parents 4fbf41a + 9090c3a commit 1623eaf

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)