1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-22 02:12:30 +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 stringToStream = require('string-to-stream');
const { platform, arch, isWindows, isMac } = require('./util');
const { platform, arch, isWindows, isMac, isLinux } = require('./util');
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
function runFfmpegProcess(args, execaOptions, { logCli = true } = {}) {
function runFfmpegProcess(args, customExecaOptions, { logCli = true } = {}) {
const ffmpegPath = getFfmpegPath();
if (logCli) console.log(getFfCommandLine('ffmpeg', args));
const process = execa(ffmpegPath, args, execaOptions);
const process = execa(ffmpegPath, args, getExecaOptions(customExecaOptions));
(async () => {
runningFfmpegs.add(process);
@ -126,7 +133,7 @@ async function runFfmpegWithProgress({ ffmpegArgs, duration, onProgress }) {
async function runFfprobe(args, { timeout = isDev ? 10000 : 30000 } = {}) {
const ffprobePath = getFfprobePath();
console.log(getFfCommandLine('ffprobe', args));
const ps = execa(ffprobePath, args);
const ps = execa(ffprobePath, args, getExecaOptions());
const timer = setTimeout(() => {
console.warn('killing timed out ffprobe');
ps.kill();

View File

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