Skip to content

🎥 Make videos programmatically with React

fix render job cleanup

Jonny Burgerc8067d816832
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 905ddeb4fc..7a0f80dc7c 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -60,39 +60,42 @@ export const render = async (remotionRoot: string, args: string[]) => {
});
const jobCleanups: (() => Promise<void>)[] = [];
-
- await renderCompFlow({
- ffmpegExecutable,
- ffprobeExecutable,
- fullEntryPoint,
- remotionRoot,
- browserExecutable,
- indentOutput: false,
- logLevel: ConfigInternals.Logging.getLogLevel(),
- browser,
- chromiumOptions,
- scale,
- shouldOutputImageSequence,
- publicDir,
- envVariables,
- inputProps,
- puppeteerTimeout,
- port,
- height,
- width,
- remainingArgs,
- compositionIdFromUi: null,
- entryPointReason,
- overwrite,
- quiet: quietFlagProvided(),
- concurrency,
- everyNthFrame,
- frameRange,
- configFileImageFormat,
- quality,
- onProgress: () => undefined,
- addCleanupCallback: (c) => {
- jobCleanups.push(c);
- },
- });
+ try {
+ await renderCompFlow({
+ ffmpegExecutable,
+ ffprobeExecutable,
+ fullEntryPoint,
+ remotionRoot,
+ browserExecutable,
+ indentOutput: false,
+ logLevel: ConfigInternals.Logging.getLogLevel(),
+ browser,
+ chromiumOptions,
+ scale,
+ shouldOutputImageSequence,
+ publicDir,
+ envVariables,
+ inputProps,
+ puppeteerTimeout,
+ port,
+ height,
+ width,
+ remainingArgs,
+ compositionIdFromUi: null,
+ entryPointReason,
+ overwrite,
+ quiet: quietFlagProvided(),
+ concurrency,
+ everyNthFrame,
+ frameRange,
+ configFileImageFormat,
+ quality,
+ onProgress: () => undefined,
+ addCleanupCallback: (c) => {
+ jobCleanups.push(c);
+ },
+ });
+ } finally {
+ await Promise.all(jobCleanups.map((c) => c()));
+ }
};