-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
1,609 additions
and
1,215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const fs = require("fs"); | ||
|
||
if (process.platform === "win32") { | ||
if (!fs.existsSync("resources/dist")) { | ||
fs.mkdirSync("resources/dist"); | ||
} | ||
|
||
fs.copyFileSync( | ||
"node_modules/ps-list/vendor/fastlist-0.3.0-x64.exe", | ||
"resources/dist/fastlist.exe" | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ const getRandomGame = async () => { | |
} | ||
} | ||
} | ||
|
||
return null; | ||
}); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
import psList from "ps-list"; | ||
import { tasklist } from "tasklist"; | ||
import path from "node:path"; | ||
import childProcess from "node:child_process"; | ||
import { promisify } from "node:util"; | ||
import { app } from "electron"; | ||
|
||
const TEN_MEGABYTES = 1000 * 1000 * 10; | ||
const execFile = promisify(childProcess.execFile); | ||
|
||
export const getProcesses = async () => { | ||
if (process.platform === "win32") { | ||
return tasklist().then((tasks) => | ||
tasks.map((task) => ({ ...task, name: task.imageName })) | ||
); | ||
} | ||
if (process.platform == "win32") { | ||
const binaryPath = app.isPackaged | ||
? path.join(process.resourcesPath, "dist", "fastlist.exe") | ||
: path.join(__dirname, "..", "..", "resources", "dist", "fastlist.exe"); | ||
|
||
return psList(); | ||
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(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
"@locales": ["src/locales/index.ts"] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.