Fix a few bugs related to execution on Windows

This commit is contained in:
Sebastian Morr 2020-10-26 08:36:38 -07:00
parent 0fb30e99ec
commit 06063d5ee6
3 changed files with 4 additions and 3 deletions

View file

@ -27,6 +27,7 @@ func _ready():
func _input(event): func _input(event):
if event.is_action_pressed("save"): if event.is_action_pressed("save"):
if text_edit.visible:
save() save()
func clear(): func clear():

View file

@ -60,7 +60,7 @@ func run(command, crash_on_fail=true):
# On Windows, if the command contains a newline (even if inside a string), # On Windows, if the command contains a newline (even if inside a string),
# execution will end. To avoid that, we first write the command to a file, # execution will end. To avoid that, we first write the command to a file,
# and run that file with bash. # and run that file with bash.
var script_path = game.tmp_prefix_inside + "command" var script_path = game.tmp_prefix_inside + "command" + str(randi())
helpers.write_file(script_path, hacky_command) helpers.write_file(script_path, hacky_command)
result = helpers.exec(_shell_binary(), [script_path], crash_on_fail) result = helpers.exec(_shell_binary(), [script_path], crash_on_fail)
else: else:

View file

@ -43,8 +43,8 @@ func save():
text += "\n" text += "\n"
helpers.write_file(fixme_path+path, text) helpers.write_file(fixme_path+path, text)
emit_signal("saved")
close() close()
emit_signal("saved")
func close(): func close():
if _client_connection and _client_connection.is_connected_to_host(): if _client_connection and _client_connection.is_connected_to_host():