mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 13:34:54 +03:00
refactor: process watcher commands
This commit is contained in:
parent
5222d319a3
commit
4f7255a8d9
@ -8,10 +8,8 @@ import axios from "axios";
|
||||
import { exec } from "child_process";
|
||||
|
||||
const commands = {
|
||||
findWineDir: () =>
|
||||
`lsof -c wine 2>/dev/null | grep '/drive_c/windows$' | head -n 1 | awk '{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}'`,
|
||||
findWineExecutables: () =>
|
||||
`lsof -c wine 2>/dev/null | grep '\\.exe$' | awk '{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}'`,
|
||||
findWineDir: `lsof -c wine 2>/dev/null | grep '/drive_c/windows$' | head -n 1 | awk '{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}'`,
|
||||
findWineExecutables: `lsof -c wine 2>/dev/null | grep '\\.exe$' | awk '{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}'`,
|
||||
};
|
||||
|
||||
export const gamesPlaytime = new Map<
|
||||
@ -72,7 +70,7 @@ const findGamePathByProcess = (
|
||||
);
|
||||
|
||||
if (process.platform === "linux") {
|
||||
exec(commands.findWineDir(), (err, out) => {
|
||||
exec(commands.findWineDir, (err, out) => {
|
||||
if (err) return;
|
||||
|
||||
gameRepository.update(
|
||||
@ -106,7 +104,7 @@ const getSystemProcessMap = async () => {
|
||||
|
||||
if (process.platform === "linux") {
|
||||
await new Promise((res) => {
|
||||
exec(commands.findWineExecutables(), (err, out) => {
|
||||
exec(commands.findWineExecutables, (err, out) => {
|
||||
if (err) {
|
||||
res(null);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user