Skip to content

Commit

Permalink
[F] Fix windows 7 support (???)
Browse files Browse the repository at this point in the history
  • Loading branch information
hykilpikonna committed Oct 23, 2024
1 parent f3fc92d commit d5b9382
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion hyfetch/neofetch_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def run_neofetch_cmd(args: str, pipe: bool = False) -> str | None:

full_cmd = [ensure_git_bash(), cmd, *shlex.split(args)]

full_cmd = [str(c) for c in full_cmd]
if pipe:
return check_output(full_cmd).decode().strip()
else:
Expand Down Expand Up @@ -390,7 +391,8 @@ def run_fastfetch(asc: str, args: str = '', legacy: bool = False):
path.write_text(asc, 'utf-8')

# Call fastfetch with the temp file
proc = subprocess.run([ff_path, '--raw' if legacy else '--file-raw', path.absolute(), *shlex.split(args)])
proc = subprocess.run([str(ff_path), '--raw' if legacy else '--file-raw',
str(path.absolute()), *shlex.split(args)])
if proc.returncode == 144:
printc("&6Error code 144 detected: Please upgrade fastfetch to >=1.8.0 or use the 'fastfetch-old' backend")

Expand Down
5 changes: 3 additions & 2 deletions hyfetch/termenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def unix_detect_ansi_mode() -> AnsiMode | None:
:return: Ansi mode
"""
if not sys.stdout.isatty():
# Check isatty attribute exist before calling it
if hasattr(sys.stdout, 'isatty') and not sys.stdout.isatty():
return 'ansi'

term = os.environ.get('TERM')
Expand Down Expand Up @@ -54,7 +55,7 @@ def windows_detect_ansi_mode() -> AnsiMode | None:
:return: Ansi mode
"""
if not sys.stdout.isatty():
if hasattr(sys.stdout, 'isatty') and not sys.stdout.isatty():
return 'ansi'

if os.environ.get("ConEmuANSI") == "ON":
Expand Down

0 comments on commit d5b9382

Please sign in to comment.