From c2efd198a69fe46a8e9a78fee352908fe1b6db7e Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 17 Apr 2025 10:13:03 +0530 Subject: [PATCH] Revert "omitlog" - there is already an if exists check This reverts commit a2a74e2166c64d30eb0fc7847381c8f3edc15006. --- desktop/src/main/services/ffmpeg.ts | 8 +------- desktop/src/main/utils/temp.ts | 12 ++---------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/desktop/src/main/services/ffmpeg.ts b/desktop/src/main/services/ffmpeg.ts index aab43592b3..3b8e1d99f6 100644 --- a/desktop/src/main/services/ffmpeg.ts +++ b/desktop/src/main/services/ffmpeg.ts @@ -52,8 +52,6 @@ export const ffmpegExec = async ( writeToTemporaryFile: writeToTemporaryInputFile, } = await makeFileForDataOrPathOrZipItem(dataOrPathOrZipItem); - let success = false; - const outputFilePath = await makeTempFilePath(outputFileExtension); try { await writeToTemporaryInputFile(); @@ -65,16 +63,12 @@ export const ffmpegExec = async ( ); await execAsync(cmd); - // execAsync will throw on non-zero exitCode. - success = true; return await fs.readFile(outputFilePath); } finally { if (isInputFileTemporary) await deleteTempFileIgnoringErrors(inputFilePath); - await deleteTempFileIgnoringErrors(outputFilePath, { - omitLog: !success, - }); + await deleteTempFileIgnoringErrors(outputFilePath); } }; diff --git a/desktop/src/main/utils/temp.ts b/desktop/src/main/utils/temp.ts index b3a00e89ea..85bfeae33e 100644 --- a/desktop/src/main/utils/temp.ts +++ b/desktop/src/main/utils/temp.ts @@ -67,20 +67,12 @@ export const deleteTempFile = async (tempFilePath: string) => { * A variant of {@link deleteTempFile} that suppresses any errors, making it * safe to call them in a sequence without needing to handle the scenario where * one of them failing causes the rest to be skipped. - * - * @param opts - {@link omitLog} If set, an error message will not be logged if - * the file cannot be deleted. This is convenient when we're trying to delete a - * file which might not even exist, and so the error is expected. */ -export const deleteTempFileIgnoringErrors = async ( - tempFilePath: string, - opts?: { omitLog?: boolean }, -) => { +export const deleteTempFileIgnoringErrors = async (tempFilePath: string) => { try { await deleteTempFile(tempFilePath); } catch (e) { - if (!opts?.omitLog) - log.error(`Failed to delete temporary file ${tempFilePath}`, e); + log.error(`Could not delete temporary file at path ${tempFilePath}`, e); } };