From 02c64ef281fa4d0c96b43cee19a99710ebc901d4 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Mon, 6 Jan 2025 04:53:25 -0500 Subject: [PATCH] [F] Fix #379 --- crates/hyfetch/src/neofetch_util.rs | 1 + hyfetch/neofetch_util.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/hyfetch/src/neofetch_util.rs b/crates/hyfetch/src/neofetch_util.rs index 9bb36fd2..bf24e75b 100644 --- a/crates/hyfetch/src/neofetch_util.rs +++ b/crates/hyfetch/src/neofetch_util.rs @@ -438,6 +438,7 @@ where debug!(?ff_path, "fastfetch path"); let mut command = Command::new(ff_path); + command.env("FFTS_IGNORE_PARENT", "1"); command.args(args); Ok(command) } diff --git a/hyfetch/neofetch_util.py b/hyfetch/neofetch_util.py index a6ed0f73..43ad729f 100644 --- a/hyfetch/neofetch_util.py +++ b/hyfetch/neofetch_util.py @@ -333,7 +333,7 @@ def run_qwqfetch(asc: str, args: str = ''): import qwqfetch # distro_detector only return a bash variable # so we use qwqfetch builtin distro detector - print(qwqfetch.get_ascres(asc)) + print(qwqfetch.get_ascres(asc)) except ImportError as e: # module not found etc print("qwqfetch is not installed. Install it by executing:") # use print to output hint directly print("pip install git+https://github.com/nexplorer-3e/qwqfetch") # TODO: public repo @@ -379,17 +379,19 @@ def run_fastfetch(asc: str, args: str = '', legacy: bool = False): """ # Find fastfetch binary ff_path = fastfetch_path() - + if not ff_path: printc("&cError: fastfetch binary is not found. Please install fastfetch first.") exit(127) - + # Write temp file with TemporaryDirectory() as tmp_dir: tmp_dir = Path(tmp_dir) path = tmp_dir / 'ascii.txt' path.write_text(asc, 'utf-8') + os.environ['FFTS_IGNORE_PARENT'] = '1' + # Call fastfetch with the temp file proc = subprocess.run([str(ff_path), '--raw' if legacy else '--file-raw', str(path.absolute()), *shlex.split(args)])