π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix
Manav Rathiae925a240e46
diff --git a/desktop/src/main/services/ffmpeg-worker.ts b/desktop/src/main/services/ffmpeg-worker.tsindex ab9f6910be..d977d41853 100644--- a/desktop/src/main/services/ffmpeg-worker.ts+++ b/desktop/src/main/services/ffmpeg-worker.ts@@ -12,7 +12,7 @@ import path, { basename } from "node:path";import type { FFmpegCommand, ZipItem } from "../../types/ipc";import log from "../log-worker";import { messagePortMainEndpoint } from "../utils/comlink";-import { execAsync } from "../utils/electron";+import { execAsyncWorker } from "../utils/exec-worker";import {deleteTempFileIgnoringErrors,makeFileForDataOrStreamOrPathOrZipItem,@@ -98,7 +98,7 @@ const ffmpegExec = async (outputFilePath,);- await execAsync(cmd);+ await execAsyncWorker(cmd);return await fs.readFile(outputFilePath);} finally {@@ -163,7 +163,7 @@ const ffmpegConvertToMP4 = async (const cmd = substitutePlaceholders(command, inputFilePath, outputFilePath);- await execAsync(cmd);+ await execAsyncWorker(cmd);};export interface FFmpegGenerateHLSPlaylistAndSegmentsResult {@@ -458,7 +458,7 @@ const ffmpegGenerateHLSPlaylistAndSegments = async (// Run the ffmpeg command to generate the HLS playlist and segments.//// Note: Depending on the size of the input file, this may take long!- const { stderr: conversionStderr } = await execAsync(command);+ const { stderr: conversionStderr } = await execAsyncWorker(command);// Determine the dimensions of the generated video from the stderr// output produced by ffmpeg during the conversion.@@ -699,7 +699,7 @@ const pseudoFFProbeVideo = async (inputFilePath: string) => {const cmd = substitutePlaceholders(command, inputFilePath, /* NA */ "");- const { stderr } = await execAsync(cmd);+ const { stderr } = await execAsyncWorker(cmd);return stderr;};diff --git a/desktop/src/main/utils/exec-worker.ts b/desktop/src/main/utils/exec-worker.tsnew file mode 100644index 0000000000..02ac116a6d--- /dev/null+++ b/desktop/src/main/utils/exec-worker.ts@@ -0,0 +1,23 @@+import shellescape from "any-shell-escape";+import { exec } from "node:child_process";+import { promisify } from "node:util";+import log from "../log-worker";++/**+ * Run a shell command asynchronously (utility process edition).+ *+ * This is an almost verbatim copy of {@link execAsync} from `electron.ts`,+ * except it is meant to be usable from a utility process where only a subset of+ * imports are available. See [Note: Using Electron APIs in UtilityProcess].+ */+export const execAsyncWorker = async (command: string | string[]) => {+ const escapedCommand = Array.isArray(command)+ ? shellescape(command)+ : command;+ const startTime = Date.now();+ const result = await execAsync_(escapedCommand);+ log.debugString(`${escapedCommand} (${Date.now() - startTime} ms)`);+ return result;+};++const execAsync_ = promisify(exec);