-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Better browser/interactive session detection inside of WSL #1148
Commits on Mar 14, 2023
-
env: avoid virtual member call in ctor; all refresh
We had a virtual member call in the constructor of the various IEnvironment implementations, which is a code smell. Instead, lazily populate the `_variables` cache dictionary, and add an explict `Refresh` method to refresh the cache. We call `Refresh` in the `SetEnvironmentVariable` method for convenience. For testing we simply pipe through the pre-computed variables in the `internal` constructor.
Configuration menu - View commit details
-
Copy full SHA for a130fec - Browse repository at this point
Copy the full SHA a130fecView commit details -
posix-session: check for Wayland display envars
Also check for the WAYLAND_DISPLAY environment variable when determining if a graphical session/display exists for POSIX systems.
Configuration menu - View commit details
-
Copy full SHA for 4462770 - Browse repository at this point
Copy the full SHA 4462770View commit details -
fs: add abstractions for reading all text and enum dir
Add abstractions to the IFileSystem interface for enumerating directories and reading the entire contents of a file to a string.
Configuration menu - View commit details
-
Copy full SHA for d37c201 - Browse repository at this point
Copy the full SHA d37c201View commit details -
browser: split browser-check from desktop session check
Split the web browser check from the desktop session checks. In future commits we will enhance the browser-check to take in to account the WSL special case.
Configuration menu - View commit details
-
Copy full SHA for f256672 - Browse repository at this point
Copy the full SHA f256672View commit details -
wsl: add ability to detect WSL distro and version
Add methods to the WslUtils class to enable detection of a WSL distribution, and also determine which WSL version is being used. Version 1 uses the Windows NT kernel and runs the distribution in the same user-mode space as Windows programs. Version 2 uses a light-weight VM to host a real Linux kernel, and runs the distribution also inside the VM; interop with Windows is achieved using other mechanisms.
1Configuration menu - View commit details
-
Copy full SHA for afe938c - Browse repository at this point
Copy the full SHA afe938cView commit details -
ini: add basic INI file deserialiser
Add a basic INI file deserialiser
Configuration menu - View commit details
-
Copy full SHA for 6b887e1 - Browse repository at this point
Copy the full SHA 6b887e1View commit details -
wsl: add ability to run CMD/PowerShell scripts from WSL
Add ability to launch cmd.exe or PowerShell.exe scripts from inside a WSL distribution. In order to discover the location of cmd.exe/powershell.exe we need search the Windows file system that's mounted by default /mnt/c. We inspect the /etc/wsl.conf file to respect users who have changed the default mount location for Windows drives.
Configuration menu - View commit details
-
Copy full SHA for a0e2b9c - Browse repository at this point
Copy the full SHA a0e2b9cView commit details -
wsl: detect host Windows session 0 and disable browser
In order to detect if we have an interactive Windows desktop session from inside WSL we need to 'punch out' from WSL to determine the session ID and window station. Strictly speaking, except for session 0 (from Vista onwards), any Windows session can have exactly one interactive window station (always called WinSta0). However, because we cannot easily determine the window station name from a simple cmd/powershell script, we take a simplified approach which isn't 100% accurate. Instead, we only permit browser auth methods if we are NOT in Windows session 0; any other Windows session we assume we are in WinSta0. The default OpenSSH Server configuration (Windows 10+) has `sshd` running as the built-in NT user NETWORK_SERVICE, which means it runs in session 0 (the services session). This is most common scenario, other than using WSL from a 'real', interactive Windows session that we're likely to face.
Configuration menu - View commit details
-
Copy full SHA for d0b767b - Browse repository at this point
Copy the full SHA d0b767bView commit details