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

when opening browser getting text output message #5

Open
pcause opened this issue Mar 9, 2021 · 2 comments
Open

when opening browser getting text output message #5

pcause opened this issue Mar 9, 2021 · 2 comments

Comments

@pcause
Copy link

pcause commented Mar 9, 2021

if I do:

xdg-open 'https://google.com'

I get a message:

CMD.EXE was started with the above path as current directory
UNC paths are not supported. Defaulting to windows directory.

The directory is shows is \wsl\home\me\some-subdirectory - basically whatever directory i am in when it executes.

Log just shows running /mnt/c/windows/system32/cmd.exe /c start https://google.com

I am trying to run this from a curses based python app the the output messes up the screen.

[added] if i enter the cmd.exe /s start https://google.com in bash in wsl I get the same. so the message is coming from cmd.exe. wonder if powershell would handle better

[added] powershell.exe start https://google.com gives no messages

[added] sorry, changed the script to use /mnt/c/Windows/System32/WindowsPowershell/v1.0/powershell.exe and all is file. start /c start url

@cpbotha
Copy link
Owner

cpbotha commented Apr 16, 2022

I'm glad you could solve it with powershell!

I just tested, and although it does not spam the same error message, opening links with powershell does take a measurable time longer than opening them with cmd.exe

explorer.exe also works, but in the past there have been URLs that it failed to open while cmd.exe /c start has been pretty reliable.

One could also consider going directly for the Windows FileProtocolHandler, see https://stackoverflow.com/a/49115945/532513

For now I'm going to keep the cmd.exe solution, but I'm also keeping this issue open in case more people run into it.

@ashb
Copy link

ashb commented May 17, 2023

It's probably a bad idea in case something goes wrong, but I've hacked my local copy to have this for the URL paths:

        subprocess.run(sp_run_arg, stderr=subprocess.DEVNULL)

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