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

Improved WSL 2 detection and browser resolution #410

Merged
merged 4 commits into from
Jan 16, 2022

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Jan 10, 2022

Improved WSL2 detection by using multiple heuristics.

Marp CLI will find out the browser for PDF/PPTX/image conversion automatically from the host OS (Windows). It works in WSL 1 but Puppeteer in WSL 2 cannot communicate with the browser spawned in the host OS.

I've updated isWSL() utility method for more reliable WSL 2 detection. We have no longer resolved Puppeteer from the host OS if WSL 2 was detected.

WSL2 detection is based on multiple heuristics on WSL environment:

  • If there are both of WSL_DISTRO_NAME and WSL_INTEROP environment values.
  • Else if the string of /proc/version is including Microsoft-Standard-WSL2.
  • Else if it shows that the kernel was compiled by GCC v8 and later versions.

Related to marp-team/marp#113, and may resolve marp-team/marp#247.

@yhatt yhatt merged commit c3d5c32 into main Jan 16, 2022
@yhatt yhatt deleted the improve-wsl2-browser-detection branch January 16, 2022 04:07
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

Successfully merging this pull request may close these issues.

1 participant