1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-22 10:22:31 +01:00

add LD_LIBRARY_PATH on linux

This commit is contained in:
Mikael Finstad 2023-04-09 00:11:38 +09:00
parent 3a257db89e
commit 759570ea8f
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
2 changed files with 14 additions and 5 deletions

View File

@ -3,7 +3,7 @@ const isDev = require('electron-is-dev');
const readline = require('readline'); const readline = require('readline');
const stringToStream = require('string-to-stream'); const stringToStream = require('string-to-stream');
const { platform, arch, isWindows, isMac } = require('./util'); const { platform, arch, isWindows, isMac, isLinux } = require('./util');
const execaPromise = import('execa'); const execaPromise = import('execa');
@ -88,11 +88,18 @@ function handleProgress(process, durationIn, onProgress, customMatcher = () => {
}); });
} }
function getExecaOptions({ env, ...customExecaOptions } = {}) {
const execaOptions = { ...customExecaOptions, env: { ...env } };
// https://github.com/mifi/lossless-cut/issues/1143#issuecomment-1500883489
if (isLinux && !isDev && !customFfPath) execaOptions.env.LD_LIBRARY_PATH = process.resourcesPath;
}
// todo collect warnings from ffmpeg output and show them after export? example: https://github.com/mifi/lossless-cut/issues/1469 // todo collect warnings from ffmpeg output and show them after export? example: https://github.com/mifi/lossless-cut/issues/1469
function runFfmpegProcess(args, execaOptions, { logCli = true } = {}) { function runFfmpegProcess(args, customExecaOptions, { logCli = true } = {}) {
const ffmpegPath = getFfmpegPath(); const ffmpegPath = getFfmpegPath();
if (logCli) console.log(getFfCommandLine('ffmpeg', args)); if (logCli) console.log(getFfCommandLine('ffmpeg', args));
const process = execa(ffmpegPath, args, execaOptions);
const process = execa(ffmpegPath, args, getExecaOptions(customExecaOptions));
(async () => { (async () => {
runningFfmpegs.add(process); runningFfmpegs.add(process);
@ -126,7 +133,7 @@ async function runFfmpegWithProgress({ ffmpegArgs, duration, onProgress }) {
async function runFfprobe(args, { timeout = isDev ? 10000 : 30000 } = {}) { async function runFfprobe(args, { timeout = isDev ? 10000 : 30000 } = {}) {
const ffprobePath = getFfprobePath(); const ffprobePath = getFfprobePath();
console.log(getFfCommandLine('ffprobe', args)); console.log(getFfCommandLine('ffprobe', args));
const ps = execa(ffprobePath, args); const ps = execa(ffprobePath, args, getExecaOptions());
const timer = setTimeout(() => { const timer = setTimeout(() => {
console.warn('killing timed out ffprobe'); console.warn('killing timed out ffprobe');
ps.kill(); ps.kill();

View File

@ -2,17 +2,19 @@ const os = require('os');
const frontendBuildDir = 'vite-dist'; const frontendBuildDir = 'vite-dist';
// todo dedupe between renderer and main
const platform = os.platform(); const platform = os.platform();
const arch = os.arch(); const arch = os.arch();
// todo dedupe between renderer and main
const isWindows = platform === 'win32'; const isWindows = platform === 'win32';
const isMac = platform === 'darwin'; const isMac = platform === 'darwin';
const isLinux = platform === 'linux';
module.exports = { module.exports = {
frontendBuildDir, frontendBuildDir,
isWindows, isWindows,
isMac, isMac,
isLinux,
platform, platform,
arch, arch,
}; };