Skip to content

Commit

Permalink
Merge pull request #231 from nitrictech/fix/race-condition-clean
Browse files Browse the repository at this point in the history
fix: check build directory exists before deletion
  • Loading branch information
tjholm authored Oct 26, 2021
2 parents 4fbf41a + 9090c3a commit 1623eaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/common/src/task/build-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class BuildFunctionTask extends Task<ContainerImage> {
await fs.promises.unlink(`./${contextBuildDirectory}/${imageId}.toml`);

// remove build directory if empty
if (fs.readdirSync(contextBuildDirectory).length === 0) {
if (fs.existsSync(contextBuildDirectory) && fs.readdirSync(contextBuildDirectory).length === 0) {
await fs.promises.rmdir(contextBuildDirectory);
}
} catch (e) {
Expand Down

0 comments on commit 1623eaf

Please sign in to comment.