Update .vscode, untrack and move to /contrib
This commit is contained in:
committed by
Adrián Insaurralde Avalos
parent
67990f7013
commit
d2ffabc3c8
29
contrib/.vscode/scripts/WaitForDebugpy.py
vendored
Normal file
29
contrib/.vscode/scripts/WaitForDebugpy.py
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import socket
|
||||
from contextlib import closing
|
||||
import time
|
||||
|
||||
TIMEOUT_TIME_S = 30
|
||||
RETRY_DELAY_S = 0.1
|
||||
|
||||
MAX_ATTEMPTS = TIMEOUT_TIME_S / RETRY_DELAY_S
|
||||
|
||||
def check_socket(host, port):
|
||||
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
|
||||
sock.settimeout(RETRY_DELAY_S)
|
||||
return sock.connect_ex((host, port)) == 0
|
||||
|
||||
def main():
|
||||
# DO NOT CHECK 5678 or debugpy will break
|
||||
# Check other port manually opened instead
|
||||
attempt_counter = 0
|
||||
while (not check_socket('localhost', 6000)) and attempt_counter < MAX_ATTEMPTS:
|
||||
time.sleep(RETRY_DELAY_S)
|
||||
attempt_counter += 1
|
||||
|
||||
if attempt_counter >= MAX_ATTEMPTS:
|
||||
exit(1)
|
||||
else:
|
||||
exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user