d4rkr00t/vscode-open-in-github

v1.17.1 fails to xdg-open

merschformann opened this issue · 6 comments

It seems like xdg-open integration may be broken since version v1.17.1. I am getting the following error and nothing happens.

2023-01-26 02:42:07.566 [error] Error: spawn /home/marius/.vscode/extensions/sysoev.vscode-open-in-github-1.17.1/out/xdg-open ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

It appears like this came in with this change maybe?

Anyway, if I go back to version v1.17.0 everything works as usual.

FYI: I am on Manjaro Linux (latest stable updates), Gnome 43.2, xdg-open 1.1.3+, Chrome

Also: many thanks for the extension. It's really useful! 🤗

Same here with Fedora 37, Sway Window Manager 1.7, xdg-open 1.1.3, Chrome 109

Same here! Also, opn 5.4.0 is over 4 years old so I don't think using it is ideal, as it might have vulnerabilities. There is probably a better way to make the latest version work with all setups? For example, it seems like you could use the app option to bypass using the system xdg-open.

In the meantime, if you're using WSL, here is a temporary workaround, (running these using a terminal):

  • get the path from the error and cd to it:
    cd /home/[NAME]/.vscode/extensions/sysoev.vscode-open-in-github-1.17.1/out
    
  • open an editor for the xdg-open file:
    code xdg-open
    
  • paste the following content (might need to adjust if your windows system is not mounted on /mnt), and make sure to save:
    #!/bin/sh
    /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass Start "$1"
    
  • make the file executable
    chmod +x xdg-open
    

If you're using a regular Linux system using apt, you might be able to sudo apt install xdg-utils then do like above but use the following snippet as the content of the file:

#!/bin/sh
xdg-open "$1"

I can confirm that the workaround by @BaliBalo works. Just create the xdg-open file in the given path, paste above content, make it executable and all works fine again. I had xdg-open available anyway, since I regularly use it for opening files from the terminal (alias open='xdg-open').

However, it would be awesome to have a proper fix like @BaliBalo suggests.

And thank you very much for the workaround! 🤗

Released 1.17.2, which now uses open 8.4.2 with improved xdg-open detection logic, hope it helps, would appreciate if somebody can validate whether it fixes the problem or not :)

@d4rkr00t Tested on Archlinux. 1.17.0 was working, 1.17.1 was broken and 1.17.2 is opening the browser now correctly again.

I think this is completed. Sorry for forgetting to close. 😬