diff --git a/scenes/file_browser.gd b/scenes/file_browser.gd index 7fe935f..dcf9ce0 100644 --- a/scenes/file_browser.gd +++ b/scenes/file_browser.gd @@ -45,7 +45,7 @@ func update(): clear() # Files in the working directory. - var wd_files = Array(repository.shell.run("find . -type f -not -path '*/\\.git/*'").split("\n")) + var wd_files = Array((await repository.shell.run("find . -type f -not -path '*/\\.git/*'")).split("\n")) # The last entry is an empty string, remove it. wd_files.pop_back() wd_files = helpers.map(wd_files, self, "substr2") diff --git a/scenes/game.gd b/scenes/game.gd index 3a48e5c..fe9dc2f 100644 --- a/scenes/game.gd +++ b/scenes/game.gd @@ -44,14 +44,15 @@ func _ready(): # print(cmd) # helpers.crash(":)") - if global_shell.run("command -v git &>/dev/null && echo yes || echo no") == "no\n": - game.skipped_title = true - get_tree().change_scene_to_file("res://scenes/no_git.tscn") - else: - create_file_in_game_env(".gitconfig", helpers.read_file("res://scripts/gitconfig")) - - copy_script_to_game_env("fake-editor") - copy_script_to_game_env("hint") + if false: + if global_shell.run("command -v git &>/dev/null && echo yes || echo no") == "no\n": + game.skipped_title = true + get_tree().change_scene_to_file("res://scenes/no_git.tscn") + else: + create_file_in_game_env(".gitconfig", helpers.read_file("res://scripts/gitconfig")) + + copy_script_to_game_env("fake-editor") + copy_script_to_game_env("hint") func start_remote_shell(): var user_dir = ProjectSettings.globalize_path("user://") diff --git a/scenes/helpers.gd b/scenes/helpers.gd index b28fdb0..e9b8ed9 100644 --- a/scenes/helpers.gd +++ b/scenes/helpers.gd @@ -102,8 +102,8 @@ func careful_delete(path_inside): if path_inside.substr(0,expected_prefix.length()) != expected_prefix: helpers.crash("Refusing to delete directory %s that does not start with %s" % [path_inside, expected_prefix]) else: - game.global_shell.cd(game.tmp_prefix) - game.global_shell.run("rm -rf '%s'" % path_inside) + await game.global_shell.cd(game.tmp_prefix) + await game.global_shell.run("rm -rf '%s'" % path_inside) func parse(file): var text = read_file(file) diff --git a/scenes/repository.gd b/scenes/repository.gd index ae6f886..a351f04 100644 --- a/scenes/repository.gd +++ b/scenes/repository.gd @@ -49,7 +49,7 @@ func _unhandled_input(event): nodes.scale += Vector2(0.05, 0.05) func there_is_a_git(): - return shell.run("test -d .git && echo yes || echo no") == "yes\n" + return await shell.run("test -d .git && echo yes || echo no") == "yes\n" func update_everything(): there_is_a_git_cache = there_is_a_git() @@ -140,7 +140,7 @@ func update_objects(): func update_node_positions(): if there_is_a_git_cache: - var graph_text = shell.run("git log --graph --oneline --all --no-abbrev") + var graph_text = await shell.run("git log --graph --oneline --all --no-abbrev") var graph_lines = Array(graph_text.split("\n")) graph_lines.pop_back() @@ -214,7 +214,7 @@ func find_position(n): return n.position func git(args, splitlines = false): - var o = shell.run("git --no-replace-objects " + args) + var o = await shell.run("git --no-replace-objects " + args) if splitlines: o = o.split("\n") diff --git a/scenes/shell.gd b/scenes/shell.gd index 24b7ae5..ba67503 100644 --- a/scenes/shell.gd +++ b/scenes/shell.gd @@ -25,6 +25,7 @@ func run(command, crash_on_fail=true): shell_command.crash_on_fail = crash_on_fail run_async_thread(shell_command) + await shell_command.done exit_code = shell_command.exit_code return shell_command.output @@ -102,7 +103,7 @@ func run_async_thread(shell_command): #print(hacky_command) shell_command.js_callback = JavaScriptBridge.create_callback(Callable(shell_command, "callback")) - web_shell.run_in_vm(hacky_command).then(shell_command.js_callback) + web_shell.run_in_vm(command).then(shell_command.js_callback) else: helpers.crash("Unimplemented OS: %s" % _os) diff --git a/scenes/terminal.gd b/scenes/terminal.gd index 5390c6d..c423fce 100644 --- a/scenes/terminal.gd +++ b/scenes/terminal.gd @@ -200,7 +200,7 @@ func generate_completions(command): # Part2: Prevent autocompletion to only show filename at the beginning of a command. if !(command.substr(0,4) == "git " and command.split(" ").size() <= 2) and command.split(" ").size() > 1: var last_word = Array(command.split(" ")).pop_back() - var file_string = repository.shell.run("find . -type f") + var file_string = await repository.shell.run("find . -type f") var files = file_string.split("\n") files = Array(files) # The last entry is an empty string, remove it.