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

Normalised open doesn't work as expected on WSL2 #964

Open
Jarmos-san opened this issue Nov 11, 2021 · 0 comments
Open

Normalised open doesn't work as expected on WSL2 #964

Jarmos-san opened this issue Nov 11, 2021 · 0 comments

Comments

@Jarmos-san
Copy link

Jarmos-san commented Nov 11, 2021

First of thanks for sharing your dotfiles, it's been a major source of inspiration to setup my WSL2 machine lately.

So, I tried using the normalised open (line #144 of the .functions file) code snippet on a WSL2 Ubuntu distro & it won't work as expected. I suspect grep can't read the /proc/version file due to missing sudo privileges(?). I bet a better solution would be to grep the output of uname -r which doesn't require sudo privileges.

A possible "better" solution could be:

if [ ! $(uname -s) = 'Darwin' ]; then
        if [ $(uname -r | grep -i 'microsoft') ]; then
                # Ubuntu on Windows using the Linux subsystem
                alias open='explorer.exe';
        else
                alias open='xdg-open';
        fi
fi

EDIT: Provided a "better" solution & I don't mind opening a PR with the above changes 😄

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

1 participant