diff options
author | Christopher Baines <mail@cbaines.net> | 2021-04-23 12:21:04 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-04-23 12:21:04 +0100 |
commit | f836f070b35d2f360412450ec88c6dc415cf9365 (patch) | |
tree | 191cce598c5f7d24ddf7a78fa363dd7c8a165498 | |
parent | c49b1c8c7191debc1a7c523bb7a7538dd28b2d4d (diff) | |
download | build-coordinator-f836f070b35d2f360412450ec88c6dc415cf9365.tar build-coordinator-f836f070b35d2f360412450ec88c6dc415cf9365.tar.gz |
Handle receiving outputs as a bytevector
This can happen if the request doesn't arrive in chunks.
-rw-r--r-- | guix-build-coordinator/agent-messaging/http/server.scm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm index 0dd453c..c4734c9 100644 --- a/guix-build-coordinator/agent-messaging/http/server.scm +++ b/guix-build-coordinator/agent-messaging/http/server.scm @@ -441,8 +441,16 @@ port. Also, the port used can be changed by passing the --port option.\n" (mkdir-p (dirname output-file-name)) (when (file-exists? tmp-output-file-name) (delete-file tmp-output-file-name)) - (if (receive-file output-file-name - tmp-output-file-name) + (if (if (bytevector? body) + (begin + (call-with-output-file tmp-output-file-name + (lambda (output-port) + (put-bytevector output-port body))) + (rename-file tmp-output-file-name + output-file-name) + #t) + (receive-file output-file-name + tmp-output-file-name)) (no-content) (render-json "error" |