🎥 Make videos programmatically with React
Revert "`@remotion/renderer`: Get rid of READ_ONLY_FS"
Jonny Burger767608fb2505
diff --git a/packages/cli/src/ffmpeg.ts b/packages/cli/src/ffmpeg.tsindex 2885056a10..71296b8973 100644--- a/packages/cli/src/ffmpeg.ts+++ b/packages/cli/src/ffmpeg.ts@@ -2,6 +2,7 @@ import type {LogLevel} from '@remotion/renderer';import {RenderInternals} from '@remotion/renderer';import {BrowserSafeApis} from '@remotion/renderer/client';import {spawnSync} from 'node:child_process';+import {chmodSync} from 'node:fs';import path from 'node:path';import {parsedCli} from './parse-command-line';@@ -51,7 +52,9 @@ export const ffmpegCommand = (logLevel,binariesDirectory,});- RenderInternals.makeFileExecutableIfItIsNot(binary);+ if (!process.env.READ_ONLY_FS) {+ chmodSync(binary, 0o755);+ }const done = spawnSync(binary, args, {stdio: 'inherit',@@ -75,7 +78,9 @@ export const ffprobeCommand = (logLevel,binariesDirectory,});- RenderInternals.makeFileExecutableIfItIsNot(binary);+ if (!process.env.READ_ONLY_FS) {+ chmodSync(binary, 0o755);+ }const done = spawnSync(binary, args, {cwd: path.dirname(binary),diff --git a/packages/lambda/src/functions/helpers/get-chromium-executable-path.ts b/packages/lambda/src/functions/helpers/get-chromium-executable-path.tsindex 8c7ed98d34..03f5d4675f 100644--- a/packages/lambda/src/functions/helpers/get-chromium-executable-path.ts+++ b/packages/lambda/src/functions/helpers/get-chromium-executable-path.ts@@ -5,6 +5,7 @@ if (process.env.FONTCONFIG_PATH = '/opt';process.env.FONTCONFIG_FILE = '/opt/fonts.conf';+ process.env.READ_ONLY_FS = '1';process.env.DISABLE_FROM_SURFACE = '1';process.env.NO_COLOR = '1';}diff --git a/packages/renderer/src/call-ffmpeg.ts b/packages/renderer/src/call-ffmpeg.tsindex 29cd8d5fa5..883e132242 100644--- a/packages/renderer/src/call-ffmpeg.ts+++ b/packages/renderer/src/call-ffmpeg.ts@@ -1,9 +1,9 @@import execa from 'execa';import type {SpawnOptionsWithoutStdio} from 'node:child_process';import {spawn} from 'node:child_process';+import {chmodSync} from 'node:fs';import path from 'path';import {getExecutablePath} from './compositor/get-executable-path';-import {makeFileExecutableIfItIsNot} from './compositor/make-file-executable';import type {LogLevel} from './log-level';import {truthy} from './truthy';@@ -28,7 +28,9 @@ export const callFf = ({logLevel,binariesDirectory,});- makeFileExecutableIfItIsNot(executablePath);+ if (!process.env.READ_ONLY_FS) {+ chmodSync(executablePath, 0o755);+ }return execa(executablePath, args.filter(truthy), {cwd: path.dirname(executablePath),@@ -57,7 +59,9 @@ export const callFfNative = ({logLevel,binariesDirectory,});- makeFileExecutableIfItIsNot(executablePath);+ if (!process.env.READ_ONLY_FS) {+ chmodSync(executablePath, 0o755);+ }return spawn(executablePath, args.filter(truthy), {cwd: path.dirname(executablePath),diff --git a/packages/renderer/src/compositor/compose.ts b/packages/renderer/src/compositor/compose.tsindex 5a6a31c9d4..1e92192bf8 100644--- a/packages/renderer/src/compositor/compose.ts+++ b/packages/renderer/src/compositor/compose.ts@@ -1,12 +1,12 @@import {spawn} from 'node:child_process';import {createHash} from 'node:crypto';+import {chmodSync} from 'node:fs';import {copyFile} from 'node:fs/promises';import path from 'node:path';import type {DownloadMap} from '../assets/download-map';import type {LogLevel} from '../log-level';import type {Compositor} from './compositor';import {getExecutablePath} from './get-executable-path';-import {makeFileExecutableIfItIsNot} from './make-file-executable';import {makeNonce} from './make-nonce';import type {CompositorCommand,@@ -108,7 +108,9 @@ export const callCompositor = (logLevel,binariesDirectory,});- makeFileExecutableIfItIsNot(execPath);+ if (!process.env.READ_ONLY_FS) {+ chmodSync(execPath, 0o755);+ }const child = spawn(execPath, [payload], {cwd: path.dirname(execPath),diff --git a/packages/renderer/src/compositor/compositor.ts b/packages/renderer/src/compositor/compositor.tsindex 4b3b0eccc5..73f542206d 100644--- a/packages/renderer/src/compositor/compositor.ts+++ b/packages/renderer/src/compositor/compositor.ts@@ -1,4 +1,5 @@import {spawn} from 'node:child_process';+import {chmodSync} from 'node:fs';import path from 'node:path';import {getActualConcurrency} from '../get-concurrency';import type {LogLevel} from '../log-level';@@ -6,7 +7,6 @@ import {isEqualOrBelowLogLevel} from '../log-level';import {Log} from '../logger';import {serializeCommand} from './compose';import {getExecutablePath} from './get-executable-path';-import {makeFileExecutableIfItIsNot} from './make-file-executable';import {makeNonce} from './make-nonce';import type {CompositorCommand,@@ -86,7 +86,9 @@ export const startCompositor = <T extends keyof CompositorCommand>({logLevel,binariesDirectory,});- makeFileExecutableIfItIsNot(bin);+ if (!process.env.READ_ONLY_FS) {+ chmodSync(bin, 0o755);+ }const fullCommand: CompositorCommandSerialized<T> = serializeCommand(type,diff --git a/packages/renderer/src/compositor/make-file-executable.ts b/packages/renderer/src/compositor/make-file-executable.tsdeleted file mode 100644index 394a8d3889..0000000000--- a/packages/renderer/src/compositor/make-file-executable.ts+++ /dev/null@@ -1,10 +0,0 @@-/* eslint-disable no-bitwise */-import {accessSync, chmodSync, constants} from 'node:fs';--export const makeFileExecutableIfItIsNot = (path: string) => {- try {- accessSync(path, constants.X_OK);- } catch (err) {- chmodSync(path, 0o755);- }-};diff --git a/packages/renderer/src/index.ts b/packages/renderer/src/index.tsindex 482b166221..2b737c5950 100644--- a/packages/renderer/src/index.ts+++ b/packages/renderer/src/index.ts@@ -134,7 +134,6 @@ export {OnStartData, RenderFramesOutput} from './types';export {validateOutputFilename} from './validate-output-filename';import {makeDownloadMap} from './assets/download-map';-import {makeFileExecutableIfItIsNot} from './compositor/make-file-executable';import {validatePuppeteerTimeout} from './validate-puppeteer-timeout';import {validateBitrate} from './validate-videobitrate';import {@@ -223,7 +222,6 @@ export const RenderInternals = {getChromiumGpuInformation,getPortConfig,makeDownloadMap,- makeFileExecutableIfItIsNot,};// Warn of potential performance issues with Apple Silicon (M1 chip under Rosetta)