diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 9ac02d0b3..b6637365c 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -443,7 +443,7 @@ class Backend: else: if exe_cmd[0].endswith('.jar'): exe_cmd = ['java', '-jar'] + exe_cmd - elif exe_cmd[0].endswith('.exe') and not (mesonlib.is_windows() or mesonlib.is_cygwin()): + elif exe_cmd[0].endswith('.exe') and not (mesonlib.is_windows() or mesonlib.is_cygwin() or mesonlib.is_wsl()): exe_cmd = ['mono'] + exe_cmd exe_wrapper = None diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py index 1b5b86c20..4f1b6e85b 100644 --- a/mesonbuild/mesonlib/universal.py +++ b/mesonbuild/mesonlib/universal.py @@ -107,6 +107,7 @@ __all__ = [ 'is_qnx', 'is_sunos', 'is_windows', + 'is_wsl', 'iter_regexin_iter', 'join_args', 'listify', @@ -597,6 +598,8 @@ def is_windows() -> bool: platname = platform.system().lower() return platname == 'windows' +def is_wsl() -> bool: + return is_linux() and 'microsoft' in platform.version().lower() def is_cygwin() -> bool: return sys.platform == 'cygwin'