1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-01-24 15:12:16 +01:00
upscayl/electron/utils/spawn-upscayl.ts

27 lines
504 B
TypeScript
Raw Normal View History

2023-03-12 15:19:02 +05:30
import { spawn } from "child_process";
2023-09-10 23:30:49 +05:30
import { execPath } from "./get-resource-paths";
2023-03-12 15:19:02 +05:30
2023-05-01 12:25:56 +05:30
export const spawnUpscayl = (
command: string[],
logit: (...args: any) => void,
2023-05-01 12:25:56 +05:30
) => {
logit(
"📢 Upscayl Command: ",
command.filter((arg) => arg !== ""),
);
2023-03-12 15:19:02 +05:30
const spawnedProcess = spawn(
execPath,
command.filter((arg) => arg !== ""),
{
cwd: undefined,
detached: false,
},
);
2023-03-12 15:19:02 +05:30
return {
process: spawnedProcess,
kill: () => spawnedProcess.kill(),
};
};