From 30e485a653a4b4601f87beb8ab34b7a624c41e30 Mon Sep 17 00:00:00 2001 From: Tzahi12345 Date: Mon, 27 Nov 2023 01:06:17 -0500 Subject: [PATCH] Fixed issue where app would not wait for youtube-dl download to finish before proceeding --- backend/test/tests.js | 3 +-- backend/youtube-dl.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/test/tests.js b/backend/test/tests.js index a80d054..d516ac4 100644 --- a/backend/test/tests.js +++ b/backend/test/tests.js @@ -657,9 +657,8 @@ describe('youtube-dl', async function() { const downloader_api = require('../downloader'); const url = 'https://www.youtube.com/watch?v=hpigjnKl7nI'; const args = await downloader_api.generateArgs(url, 'video', {}, null, true); - const {child_process, callback} = await youtubedl_api.runYoutubeDL(url, args); + const {child_process} = await youtubedl_api.runYoutubeDL(url, args); assert(child_process); - console.log(await callback); }); }); diff --git a/backend/youtube-dl.js b/backend/youtube-dl.js index e771bdf..e48c292 100644 --- a/backend/youtube-dl.js +++ b/backend/youtube-dl.js @@ -101,7 +101,7 @@ exports.checkForYoutubeDLUpdate = async () => { // TODO: don't redownload if fork already exists if (!fs.existsSync(output_file_path) || current_fork !== selected_fork || !current_version || current_version !== latest_version) { logger.warn(`Updating ${selected_fork} binary to '${output_file_path}', downloading...`); - exports.updateYoutubeDL(latest_version); + await exports.updateYoutubeDL(latest_version); } }