From 027e3080998c3e99e3a16bc336ccf47e0f1d5a8e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 4 Jan 2021 10:05:47 +0100 Subject: [PATCH] Don't crash on youtube-dl update write error --- server/helpers/youtube-dl.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts index 9e8ef90d8..74e5f896c 100644 --- a/server/helpers/youtube-dl.ts +++ b/server/helpers/youtube-dl.ts @@ -170,7 +170,12 @@ async function updateYoutubeDLBinary () { return res() } - downloadFile.pipe(createWriteStream(bin, { mode: 493 })) + const writeStream = createWriteStream(bin, { mode: 493 }).on('error', err => { + logger.error('youtube-dl update error in write stream', { err }) + return res() + }) + + downloadFile.pipe(writeStream) }) downloadFile.on('error', err => {