check for both wsl1 and wsl2

This commit is contained in:
Cherichy
2020-05-25 00:14:36 +00:00
committed by David Adam
parent b34d9bcc97
commit f32777a0cc

View File

@@ -47,7 +47,8 @@ def is_wsl():
""" Return whether we are running under the Windows Subsystem for Linux """
if "linux" in platform.system().lower() and os.access("/proc/version", os.R_OK):
with open("/proc/version", "r") as f:
if "microsoft" in f.read():
# Find 'Microsoft' for wsl1 and 'microsoft' for wsl2
if "microsoft" in f.read().lower():
return True
return False