On Windows, wait until connection to bash has been established

This commit is contained in:
blinry 2021-03-05 14:17:48 +01:00
parent e952c97cb6
commit 5770fa6896

View file

@ -25,9 +25,9 @@ func _ready():
get_tree().set_auto_accept_quit(false) get_tree().set_auto_accept_quit(false)
else: else:
game.toggle_music() game.toggle_music()
start_remote_shell() if OS.get_name() == "Windows":
yield(get_tree().create_timer(0.1), "timeout") start_remote_shell()
global_shell = new_shell() global_shell = new_shell()
# var cmd = global_shell.run("echo hi") # var cmd = global_shell.run("echo hi")
@ -141,11 +141,15 @@ func toggle_music():
func shell_test(command): func shell_test(command):
mutex.lock() mutex.lock()
#print("go") #print("go")
print(command) #print(command)
var before = OS.get_ticks_msec() var before = OS.get_ticks_msec()
while not $ShellServer._connected:
$ShellServer._process(0.1)
var response = $ShellServer.send(command) var response = $ShellServer.send(command)
var after = OS.get_ticks_msec() var after = OS.get_ticks_msec()
print("took " + str(after-before)+" ms") #print("took " + str(after-before)+" ms")
#print("stop") #print("stop")
mutex.unlock() mutex.unlock()
return response return response