Store reference to thread in ShellCommand

This commit is contained in:
blinry 2020-11-02 15:19:52 +01:00
parent e220211140
commit 664fefe2e5
2 changed files with 6 additions and 4 deletions

View file

@ -31,12 +31,13 @@ func run_async(command, crash_on_fail=true):
shell_command.command = command
shell_command.crash_on_fail = crash_on_fail
var _thread = Thread.new()
_thread.start(self, "run_async_thread", shell_command)
var t = Thread.new()
shell_command.thread = t
t.start(self, "run_async_thread", shell_command)
return shell_command
func run_async_thread(shell_command):
func run_async_thread(shell_command):
var debug = false
var command = shell_command.command
@ -88,7 +89,7 @@ func run_async_thread(shell_command):
shell_command.output = result["output"]
shell_command.exit_code = result["exit_code"]
shell_command.emit_signal("done")
shell_command.emit_signal("done")
func _shell_binary():
if _os == "X11" or _os == "OSX":

View file

@ -7,3 +7,4 @@ var command
var output
var exit_code
var crash_on_fail = true
var thread