fix(mcp): Consider WAYLAND_DISPLAY for headed operation on Linux.#41265
fix(mcp): Consider WAYLAND_DISPLAY for headed operation on Linux.#41265smurfix wants to merge 2 commits into
Conversation
|
@microsoft-github-policy-service agree |
| const browser = await validateBrowserConfig(result.browser); | ||
| if (browser.launchOptions.headless === undefined) | ||
| browser.launchOptions.headless = os.platform() === 'linux' && !process.env.DISPLAY; | ||
| browser.launchOptions.headless = os.platform() === 'linux' && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY; |
There was a problem hiding this comment.
from what im reading it seems like $WAYLAND_DISPLAY is often a string, and some forums suggest setting it to something known to be nonexistent (e.g. WAYLAND_DISPLAY=no) so im not sure we can just falsy check it here
can you please give a bit more of an explanation as to your setup so we can better understand why this would solve the problem and is the best approach to do so?
There was a problem hiding this comment.
I have no idea why people set WAYLAND_DISPLAY to "no" as opposed to simply unsetting it. Anyway, the reason somebody does this is most likely because they want to use X11 instead, i.e. DISPLAY is set anyway, so this is not a problem.
The reason why I need this is because X11 is widely considered to be fairly insecure all around; none of the tools I'm using need it any more; and because I want the installation to be as minimal as possible (don't want to assemble a Docker image with a heap of unused X11 libraries and all that …).
Alternate solution: add an explicit "--headed" option …
There was a problem hiding this comment.
Adding --headed sounds like a right approach if you deliberately want to run headed browser.
Test results for "MCP"7289 passed, 1122 skipped Merge workflow run. |
Test results for "tests 1"3 flaky39546 passed, 743 skipped Merge workflow run. |
On Linux a minimal(istic) installation might not contain XWayland, as it's no longer required for modern browsers.
Hence the DISPLAY envvar is not set. Thus, fallback to WAYLAND_DISPLAY.