Replace exec with execFile in MacOS Quick Preview

This commit is contained in:
Janosch Maier 2022-03-29 21:22:49 +02:00 committed by Ben Gotow
parent 17e9a88eb0
commit cc43896650

View file

@ -1,5 +1,5 @@
import { exec } from 'child_process';
import { execFile } from 'child_process';
import path from 'path';
import { File } from 'mailspring-exports';
@ -336,13 +336,14 @@ function _generateNextCrossplatformPreview() {
}
async function _generateQuicklookPreview({ filePath }: { filePath: string }) {
const dirQuoted = `"${path.dirname(filePath).replace(/"/g, '\\"')}"`;
const pathQuoted = `"${filePath.replace(/"/g, '\\"')}"`;
const dirQuoted = path.dirname(filePath).replace(/"/g, '\\"')
const pathQuoted = filePath.replace(/"/g, '\\"')
return new Promise(resolve => {
const cmd = `qlmanage -t -f ${window.devicePixelRatio} -s ${ThumbnailWidth} -o ${dirQuoted} ${pathQuoted}`;
const cmd = '/usr/bin/qlmanage';
const args = ['-t', "-f", `${window.devicePixelRatio}`, '-s', `${ThumbnailWidth}`, '-o', dirQuoted, pathQuoted]
exec(cmd, (error, stdout, stderr) => {
execFile(cmd, args, (error, stdout, stderr) => {
// Note: sometimes qlmanage outputs to stderr but still successfully
// produces a thumbnail. It complains about bad plugins pretty often.
if (