Skip to content

Commit 019d5ec

Browse files
Add In_WSL function to check whether the host runs on WSL (#12799)
1 parent 21b3a06 commit 019d5ec

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
.coverage.*
77
htmlcov
88
*.orig
9+
*.sln
910

1011
# ignore .vs files that store temproray cache of visual studio workspace settings
1112
.vs

localstack-core/localstack/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ def is_windows() -> bool:
277277
return platform.system().lower() == "windows"
278278

279279

280+
def is_wsl() -> bool:
281+
return platform.system().lower() == "linux" and os.environ.get("WSL_DISTRO_NAME") is not None
282+
283+
280284
def ping(host):
281285
"""Returns True if the host responds to a ping request"""
282286
is_in_windows = is_windows()
@@ -384,6 +388,8 @@ def in_docker():
384388
is_in_docker = in_docker()
385389
is_in_linux = is_linux()
386390
is_in_macos = is_macos()
391+
is_in_windows = is_windows()
392+
is_in_wsl = is_wsl()
387393
default_ip = "0.0.0.0" if is_in_docker else "127.0.0.1"
388394

389395
# CLI specific: the configuration profile to load

0 commit comments

Comments
 (0)