Skip to content

Commit

Permalink
works again on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jr1221 committed Oct 14, 2024
1 parent 15b31c1 commit e2af96b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ner_environment/build_system/build_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ def debug(args):

# for some reason the host docker internal thing is broken on linux despite compose being set correctly, hence this hack
gdb_uri = "host.docker.internal"
if platform.system() == "Linux":
if platform.system() == "Linux" and is_wsl() == 0:
gdb_uri = "localhost"

send_command = ["docker", "compose", "run", "--rm", "ner-gcc-arm", "arm-none-eabi-gdb", f"/home/app/build/{elf_file}", "-ex", f"target extended-remote {gdb_uri}:3333"]

print(send_command)
subprocess.run(send_command)

# make terminal clearer
Expand Down Expand Up @@ -345,6 +344,18 @@ def disconnect_usbip():
command = ["sudo", "usbip", "detach", "-p", "0"]
run_command(command, exit_on_fail=False)

def is_wsl(v: str = platform.uname().release) -> int:
"""
detects if Python is running in WSL
"""

if v.endswith("-Microsoft"):
return 1
elif v.endswith("microsoft-standard-WSL2"):
return 2

return 0


if __name__ == "__main__":
main()
Expand Down

0 comments on commit e2af96b

Please sign in to comment.