fix: stop is_wsl false-positiving in Docker on a WSL2 host#56
Merged
Conversation
A Docker container shares the host kernel, so on a WSL2 host /proc/version inside the container also contains "microsoft" and is_wsl returned true. That triggered remove_win_node_from_path -> wslpath on every shell start, emitting "wslpath: command not found", plus bogus Explorer.exe/clip.exe aliases. Additionally require a WSL-only interop marker ($WSL_DISTRO_NAME, /run/WSL, or a wslpath binary). Real WSL2 has all three; a container on a WSL2 host has none. Verified in a container on a WSL2 host: is_wsl is now false there (no wslpath noise) and still true when any WSL marker is present. Fixes #50 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A Docker container shares the host kernel, so on a WSL2 host
/proc/versioninside the container also contains "microsoft" andis_wsl()returned true. On every shell start that triggeredinit_node->remove_win_node_from_path->get_win_c_path->wslpath, which doesn't exist in the container:(plus bogus
Explorer.exe/clip.exealiases). Non-fatal, but noisy and wrong.Fix
Keep the kernel check, but also require a WSL-only interop marker:
Real WSL2 has all three markers; a container on a WSL2 host has none.
Verification (container running on a WSL2 host)
Fixes #50
🤖 Generated with Claude Code