mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: run fastfile binary from resources folder
feat: run process watcher each 300ms feat: add build step to copy fastlist from node_modules feat: create postinstall script to copy fastlist binary remove debug logs
This commit is contained in:
parent
854b23e4ef
commit
0bbd7d013f
6 changed files with 44 additions and 10 deletions
|
@ -1,5 +1,32 @@
|
|||
import psList from "ps-list";
|
||||
import path from "node:path";
|
||||
import childProcess from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
export const getProcesses = async () => {
|
||||
return psList();
|
||||
const TEN_MEGABYTES = 1000 * 1000 * 10;
|
||||
const execFile = promisify(childProcess.execFile);
|
||||
|
||||
export const getProcesses = async (isPackaged: boolean) => {
|
||||
if (process.platform == "win32") {
|
||||
const binaryPath = isPackaged
|
||||
? path.join(process.resourcesPath, "fastlist.exe")
|
||||
: path.join(__dirname, "..", "..", "resources", "fastlist.exe");
|
||||
|
||||
const { stdout } = await execFile(binaryPath, {
|
||||
maxBuffer: TEN_MEGABYTES,
|
||||
windowsHide: true,
|
||||
});
|
||||
|
||||
return stdout
|
||||
.trim()
|
||||
.split("\r\n")
|
||||
.map((line) => line.split("\t"))
|
||||
.map(([pid, ppid, name]) => ({
|
||||
pid: Number.parseInt(pid, 10),
|
||||
ppid: Number.parseInt(ppid, 10),
|
||||
name,
|
||||
}));
|
||||
} else {
|
||||
return psList();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue