diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-10-09 19:16:20 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-10-09 19:16:20 -0300 |
commit | 150d8747325fc95f8532a371f2b6e2eaaf1d893c (patch) | |
tree | 44658271542caf7b092d9b3d4a8e0c8130f7b13f /src/write/build-modes | |
parent | ec34eb807178050fab744996007a2ff8038cde64 (diff) |
write: live-dev-server: fix premature close crash in pipeline
Diffstat (limited to 'src/write/build-modes')
-rw-r--r-- | src/write/build-modes/live-dev-server.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js index 42a4ab74..f6eec334 100644 --- a/src/write/build-modes/live-dev-server.js +++ b/src/write/build-modes/live-dev-server.js @@ -321,7 +321,16 @@ export async function go({ 'Content-Length': size, }); - await pipeline(fd.createReadStream(), response); + try { + await pipeline(fd.createReadStream(), response); + } catch (error) { + if (error.code === 'ERR_STREAM_PREMATURE_CLOSE') { + // Connection was dropped, this is OK. + return; + } else { + throw error; + } + } if (loudResponses) console.log(`${requestHead} [200] ${pathname} (${colors.magenta(`web route`)})`); |