diff options
author | Christopher Baines <mail@cbaines.net> | 2021-11-26 22:53:59 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-11-26 22:53:59 +0000 |
commit | 148aba38889e9442e48f853e080c893112d87849 (patch) | |
tree | c3770fcad068cf8c51e9983f11c8cb8f7a67c931 /guix-build-coordinator/agent-messaging | |
parent | 13ff8c93bbcef02c41e08f1240b1fe32fb9ffaa3 (diff) | |
download | build-coordinator-148aba38889e9442e48f853e080c893112d87849.tar build-coordinator-148aba38889e9442e48f853e080c893112d87849.tar.gz |
Check before deleting files
As I've seen exceptions here.
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r-- | guix-build-coordinator/agent-messaging/http/server.scm | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm index 26c2279..3b459b0 100644 --- a/guix-build-coordinator/agent-messaging/http/server.scm +++ b/guix-build-coordinator/agent-messaging/http/server.scm @@ -413,12 +413,13 @@ port. Also, the port used can be changed by passing the --port option.\n" 'WARN (simple-format #f "error computing hash: ~A" exn)) - ;; I've seen exceptions happen here from lzip, so try - ;; deleting the tmp file so that it's re-uploaded. - (log-msg logger - 'WARN - (simple-format #f "deleting ~A" file-name)) - (delete-file file-name) + (when (file-exists? file-name) + ;; I've seen exceptions happen here from lzip, so try + ;; deleting the tmp file so that it's re-uploaded. + (log-msg logger + 'WARN + (simple-format #f "deleting ~A" file-name)) + (delete-file file-name)) (raise-exception exn)) (lambda () @@ -553,12 +554,13 @@ port. Also, the port used can be changed by passing the --port option.\n" 'WARN (simple-format #f "error computing hash: ~A" exn)) - ;; I've seen exceptions happen here from lzip, so try - ;; deleting the tmp file so that it's re-uploaded. - (log-msg logger - 'WARN - (simple-format #f "deleting ~A" file-name)) - (delete-file file-name) + (when (file-exists? file-name) + ;; I've seen exceptions happen here from lzip, so try + ;; deleting the tmp file so that it's re-uploaded. + (log-msg logger + 'WARN + (simple-format #f "deleting ~A" file-name)) + (delete-file file-name)) (raise-exception exn)) (lambda () |