Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with WSL installed #179

Open
1 task done
RuiNtD opened this issue Aug 26, 2023 · 11 comments
Open
1 task done

Doesn't work with WSL installed #179

RuiNtD opened this issue Aug 26, 2023 · 11 comments

Comments

@RuiNtD
Copy link

RuiNtD commented Aug 26, 2023

Describe the bug

Trying to run hyfetch with WSL installed causes it to launch WSL's bash instead of Git Bash

  • Does this issue still occur in the master branch? (Required)

Expected behavior

Git Bash is run instead of WSL Bash

Screenshots

Config file

I don't have a config file

Additional context

/bin/bash: line 1: /c/Users/ethan/scoop/apps/python/current/Lib/site-packages/hyfetch/scripts/neowofetch: No such file or directory
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\ethan\scoop\apps\python\current\Scripts\hyfetch.exe\__main__.py", line 7, in <module>
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\main.py", line 375, in run
    config = create_config() if args.config else check_config(args.config_file)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\main.py", line 34, in check_config
    return create_config()
           ^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\main.py", line 47, in create_config
    asc = get_distro_ascii()
          ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 317, in get_distro_ascii
    det = distro_detector.detect(distro or get_distro_name())
                                           ^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 338, in get_distro_name
    return run_neofetch_cmd('ascii_distro_name', True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 298, in run_neofetch_cmd
    return check_output(full_cmd).decode().strip()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '[WindowsPath('C:/WINDOWS/system32/bash.exe'), '-c', "'/c/Users/ethan/scoop/apps/python/current/Lib/site-packages/hyfetch/scripts/neowofetch' ascii_distro_name"]' returned non-zero exit status 127.
@RuiNtD
Copy link
Author

RuiNtD commented Aug 26, 2023

I'm realizing that if you did try to run it in WSL, it would just give info on WSL instead of Windows. Maybe you could detect if the location of bash.exe is either %windir%\system32\bash.exe or %LocalAppData%\Microsoft\WindowsApps\bash.exe and search the PATH for a bash.exe sitting next to git.exe?

@CarterLi
Copy link

Does scoop install fastfetch hyfetch -b fastfetch works for you?

@RuiNtD
Copy link
Author

RuiNtD commented Aug 27, 2023

Nope.

> hyfetch -b fastfetch
/bin/bash: line 1: /c/Users/ethan/scoop/apps/python/current/Lib/site-packages/hyfetch/scripts/neowofetch: No such file or directory
Error: Command '[WindowsPath('C:/WINDOWS/system32/bash.exe'), '-c', "'/c/Users/ethan/scoop/apps/python/current/Lib/site-packages/hyfetch/scripts/neowofetch' ascii_distro_name"]' returned non-zero exit status 127.
Traceback (most recent call last):
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\main.py", line 422, in run
    asc = get_distro_ascii() if not args.ascii_file else Path(args.ascii_file).read_text("utf-8")
          ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 317, in get_distro_ascii
    det = distro_detector.detect(distro or get_distro_name())
                                           ^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 338, in get_distro_name
    return run_neofetch_cmd('ascii_distro_name', True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 298, in run_neofetch_cmd
    return check_output(full_cmd).decode().strip()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '[WindowsPath('C:/WINDOWS/system32/bash.exe'), '-c', "'/c/Users/ethan/scoop/apps/python/current/Lib/site-packages/hyfetch/scripts/neowofetch' ascii_distro_name"]' returned non-zero exit status 127.

@CarterLi
Copy link

Strange. Does running fastfetch directly work?

@RuiNtD
Copy link
Author

RuiNtD commented Aug 27, 2023

Yep. I'm pretty sure it's still calling neowofetch for the distro ASCII art, because I've noticed that if I call hyfetch directly from Git Bash, it replaces fastfetch's ASCII art for Windows 11 with neowofetch's ASCII art (which is different).

@CarterLi
Copy link

@CarterLi
Copy link

CarterLi commented Aug 27, 2023

Just tried it myself. Hyfetch forces me installing Git Windows (while fastfetch doesn't use bash and I do have Git Windows installed). If I run hyfetch in Git Bash, it stacks with

Welcome to hyfetch Let's set up some colors first.
1. Detected color mode:           rgb

2. Is your terminal in light mode or dark mode? (light|dark)
>

Even Ctrl+C doesn't work

@RuiNtD
Copy link
Author

RuiNtD commented Aug 27, 2023

The issue only occurs if you have WSL, since it adds a bash.exe to PATH. As for the config with Git Bash, I had to copy my config from WSL after setting it up there. The setup not working on Windows is a separate issue.

@CarterLi
Copy link

Because of the bad experience, I prefer using fastfetch directly. I customised the logo with

fastfetch --logo-color-1 blue --logo-color-2 green --logo-color-3 cyan --logo-color-4 magenta --logo-padding-top 2

I think it's good-looking enough

image

@hykilpikonna
Copy link
Owner

hykilpikonna commented Sep 7, 2023

Maybe it would be better to make fastfetch the default backend on Windows and somehow install fastfetch as a dependency, since Windows doesn't have a proper built-in bash environment and different third-party implementations come with different quirks...

@hykilpikonna
Copy link
Owner

Maybe it would be better to make fastfetch the default backend on Windows and somehow install fastfetch as a dependency, since Windows doesn't have a proper built-in bash environment and different third-party implementations come with different quirks...

...but even then the Windows terminal (or CMD on older versions of Windows) wouldn't support outputting ANSI RGB colors with a simple ascii file replacement on the fastfetch backend. So I guess the best bet is still to embed a specific version of git bash into hyfetch packaging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants