Skip to content

Commit

Permalink
bs_fetch: consider unlink ENOENT as a success
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Jan 17, 2022
1 parent b24dd40 commit 9fbc008
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

* Consider `unlink` failing with `ENOENT` as a success.

# 1.10.0

* Delay requiring `FileUtils`. (#285)
Expand Down
8 changes: 6 additions & 2 deletions ext/bootsnap/bootsnap.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,12 @@ bs_fetch(char * path, VALUE path_v, char * cache_path, VALUE handler, VALUE args
/* If output_data is nil, delete the cache entry and generate the output
* using input_to_output */
if (unlink(cache_path) < 0) {
errno_provenance = "bs_fetch:unlink";
goto fail_errno;
/* If the cache was already deleted, it might be that another process did it before us.
* No point raising an error */
if (errno != ENOENT) {
errno_provenance = "bs_fetch:unlink";
goto fail_errno;
}
}
bs_input_to_output(handler, args, input_data, &output_data, &exception_tag);
if (exception_tag != 0) goto raise;
Expand Down

0 comments on commit 9fbc008

Please sign in to comment.