💥 ags(scripts/utils): actually fix the isInstalled() method

This commit is contained in:
retrozinndev
2025-05-17 19:02:27 -03:00
parent a043bce496
commit 9c1cd7362b
+6 -3
View File
@@ -1,4 +1,4 @@
import { exec, execAsync, GLib } from "astal"; import { exec, execAsync, Gio, GLib } from "astal";
export function getHyprlandInstanceSig(): (string|null) { export function getHyprlandInstanceSig(): (string|null) {
@@ -18,8 +18,11 @@ export function deleteFile(path: string): void {
} }
export function isInstalled(commandName: string): boolean { export function isInstalled(commandName: string): boolean {
const output = exec(["bash", "-c", `command -v ${commandName}`]); const proc = Gio.Subprocess.new(["bash", "-c", `command -v ${commandName}`],
if(output) Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE);
const [ , stdout, stderr ] = proc.communicate_utf8(null, null);
if(stdout && !stderr)
return true; return true;
return false; return false;