mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 13:34:54 +03:00
refactor: move exec command to a function
This commit is contained in:
parent
311b011ec6
commit
fcfaae7b58
@ -7,6 +7,11 @@ import { Game } from "@main/entity";
|
||||
import axios from "axios";
|
||||
import { exec } from "child_process";
|
||||
|
||||
const commands = {
|
||||
findGameExecutableWithWineProcess: (executable: string) =>
|
||||
`lsof -c wine 2>/dev/null | grep -i ${executable} | awk \'{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}\'`,
|
||||
};
|
||||
|
||||
export const gamesPlaytime = new Map<
|
||||
number,
|
||||
{ lastTick: number; firstTick: number; lastSyncTick: number }
|
||||
@ -135,7 +140,7 @@ export const watchProcesses = async () => {
|
||||
if (process.platform === "linux") {
|
||||
if (executable.endsWith(".exe")) {
|
||||
exec(
|
||||
`lsof -c wine 2>/dev/null | grep -i ${executable} | awk \'{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}\'`,
|
||||
commands.findGameExecutableWithWineProcess(executable),
|
||||
(err, out) => {
|
||||
if (err) return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user