From 5770fa689602e247bc6e645d0a425aa621825fe8 Mon Sep 17 00:00:00 2001 From: blinry Date: Fri, 5 Mar 2021 14:17:48 +0100 Subject: [PATCH] On Windows, wait until connection to bash has been established --- scenes/game.gd | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scenes/game.gd b/scenes/game.gd index 16db4c9..2f2a0b5 100644 --- a/scenes/game.gd +++ b/scenes/game.gd @@ -25,9 +25,9 @@ func _ready(): get_tree().set_auto_accept_quit(false) else: game.toggle_music() - - start_remote_shell() - yield(get_tree().create_timer(0.1), "timeout") + + if OS.get_name() == "Windows": + start_remote_shell() global_shell = new_shell() # var cmd = global_shell.run("echo hi") @@ -141,11 +141,15 @@ func toggle_music(): func shell_test(command): mutex.lock() #print("go") - print(command) + #print(command) var before = OS.get_ticks_msec() + + while not $ShellServer._connected: + $ShellServer._process(0.1) + var response = $ShellServer.send(command) var after = OS.get_ticks_msec() - print("took " + str(after-before)+" ms") + #print("took " + str(after-before)+" ms") #print("stop") mutex.unlock() return response