summaryrefslogtreecommitdiff
path: root/guix/scripts/publish.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2015-10-07 23:55:17 -0400
committerMark H Weaver <mhw@netris.org>2015-10-07 23:55:17 -0400
commit319fe79dd01e03c4ef61311c336bcd77e1133f02 (patch)
treec169d85b429a801fdc22ce27c25b7e4230eb320a /guix/scripts/publish.scm
parent9511de1ef8c59788f2c93ae6b0cb1e87e30824ab (diff)
parenta606ed89d4e3737beec2f3392bedba61904778f4 (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/scripts/publish.scm')
-rw-r--r--guix/scripts/publish.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm
index e352090d2d..fb7b4218e0 100644
--- a/guix/scripts/publish.scm
+++ b/guix/scripts/publish.scm
@@ -256,6 +256,16 @@ example: \"/foo/bar\" yields '(\"foo\" \"bar\")."
(response-headers response)
eq?)))
+(define-syntax-rule (swallow-EPIPE exp ...)
+ "Swallow EPIPE errors raised by EXP..."
+ (catch 'system-error
+ (lambda ()
+ exp ...)
+ (lambda args
+ (if (= EPIPE (system-error-errno args))
+ (values)
+ (apply throw args)))))
+
(define (http-write server client response body)
"Write RESPONSE and BODY to CLIENT, possibly in a separate thread to avoid
blocking."
@@ -274,7 +284,8 @@ blocking."
;; way to avoid building the whole nar in memory, which could
;; quickly become a real problem. As a bonus, we even do
;; sendfile(2) directly from the store files to the socket.
- (write-file (utf8->string body) port)
+ (swallow-EPIPE
+ (write-file (utf8->string body) port))
(close-port port)
(values)))))
(_