From 0157b85ae161e01caeb2d3b11842640ef051a144 Mon Sep 17 00:00:00 2001 From: Oleh Polisan Date: Sun, 2 Jun 2024 00:29:15 +0300 Subject: [PATCH] fixed imports --- src/main/keybinds.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/keybinds.ts b/src/main/keybinds.ts index 5289caec..d722bdfb 100644 --- a/src/main/keybinds.ts +++ b/src/main/keybinds.ts @@ -4,27 +4,27 @@ * Copyright (c) 2023 Vendicated and Vencord contributors */ -import child_process from "node:child_process"; -import fs from "node:fs"; -import path from "node:path"; +import { spawnSync } from "node:child_process"; +import { constants, open } from "node:fs"; +import { join } from "node:path"; -import net from "net"; +import { Socket } from "net"; import { IpcEvents } from "shared/IpcEvents"; import { mainWin } from "./mainWindow"; const xdgRuntimeDir = process.env.XDG_RUNTIME_DIR || process.env.TMP || "/tmp"; -const socketFile = path.join(xdgRuntimeDir, "vesktop-ipc"); +const socketFile = join(xdgRuntimeDir, "vesktop-ipc"); export function initKeybinds() { - child_process.spawnSync("mkfifo", [socketFile]); - fs.open(socketFile, fs.constants.O_RDONLY | fs.constants.O_NONBLOCK, (err, fd) => { + spawnSync("mkfifo", [socketFile]); + open(socketFile, constants.O_RDONLY | constants.O_NONBLOCK, (err, fd) => { if (err) { console.error("Error opening pipe:", err); return; } - const pipe = new net.Socket({ fd }); + const pipe = new Socket({ fd }); pipe.on("data", data => { const Actions = new Set([IpcEvents.TOGGLE_SELF_DEAF, IpcEvents.TOGGLE_SELF_MUTE]); const action = data.toString().trim(); @@ -33,7 +33,7 @@ export function initKeybinds() { } }); - pipe.on("end", () => { + pipe.once("end", () => { pipe.destroy(); initKeybinds(); });