From ae83089c12f1e4dac25b92deb1e3d2360e1afa0b Mon Sep 17 00:00:00 2001 From: Azalea Gui <22280294+hykilpikonna@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:48:31 -0400 Subject: [PATCH] [F] Fix path --- scripts/bin/tmux-tool.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/bin/tmux-tool.py b/scripts/bin/tmux-tool.py index 99ca7a2..285d2fc 100755 --- a/scripts/bin/tmux-tool.py +++ b/scripts/bin/tmux-tool.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 import os +from pathlib import Path import re +from shutil import which import subprocess import argparse from datetime import datetime @@ -58,18 +60,20 @@ def get_ip_address(): return None def get_hardware_info(cpu=False, gpu=False): + # Check if command exist + fastfetch = which('fastfetch') or Path(__file__).parent / 'fastfetch' try: cpu_str, gpu_str = '', '' if cpu: # Fetch CPU info - cpu_info = subprocess.run(['fastfetch', '--logo', 'none', '-s', 'CPU'], stdout=subprocess.PIPE) + cpu_info = subprocess.run([fastfetch, '--logo', 'none', '-s', 'CPU'], stdout=subprocess.PIPE) cpu_str = cpu_info.stdout.decode().strip() # cpu_str = cpu_str.split(':', 1)[1].split('@', 1)[0].strip() cpu_str = cpu_str.split(':', 1)[1].strip() if gpu: # Fetch GPU info - gpu_info = subprocess.run(['fastfetch', '--logo', 'none', '-s', 'GPU'], stdout=subprocess.PIPE) + gpu_info = subprocess.run([fastfetch, '--logo', 'none', '-s', 'GPU'], stdout=subprocess.PIPE) gpu_str = gpu_info.stdout.decode().strip() gpu_str = gpu_str.split(':', 1)[1].strip()