2023-03-12 10:49:02 +01:00
|
|
|
import { spawn } from "child_process";
|
2023-09-10 20:00:49 +02:00
|
|
|
import { execPath } from "./get-resource-paths";
|
2023-03-12 10:49:02 +01:00
|
|
|
|
2023-05-01 08:55:56 +02:00
|
|
|
export const spawnUpscayl = (
|
|
|
|
command: string[],
|
2024-04-21 19:14:39 +02:00
|
|
|
logit: (...args: any) => void,
|
2023-05-01 08:55:56 +02:00
|
|
|
) => {
|
2024-01-16 09:19:27 +01:00
|
|
|
logit(
|
|
|
|
"📢 Upscayl Command: ",
|
2024-04-21 19:14:39 +02:00
|
|
|
command.filter((arg) => arg !== ""),
|
2024-01-16 09:19:27 +01:00
|
|
|
);
|
2023-03-12 10:49:02 +01:00
|
|
|
|
2024-01-16 09:19:27 +01:00
|
|
|
const spawnedProcess = spawn(
|
|
|
|
execPath,
|
|
|
|
command.filter((arg) => arg !== ""),
|
|
|
|
{
|
|
|
|
cwd: undefined,
|
|
|
|
detached: false,
|
2024-04-21 19:14:39 +02:00
|
|
|
},
|
2024-01-16 09:19:27 +01:00
|
|
|
);
|
2023-03-12 10:49:02 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
process: spawnedProcess,
|
|
|
|
kill: () => spawnedProcess.kill(),
|
|
|
|
};
|
|
|
|
};
|