Godot Version
4.4.1
Question
I’m trying to execute another instance of my Godot program with OS.execute_with_pipe()
, and assigning the return value to a variable to access its “stdio” and “pid”. I’m also setting the blocking parameter to false. However, I believe the blocking parameter doesn’t seem to work as expected.
The return value IS set to variable correctly (like, it returns the right process ID of the excepted new process), and the main process continues to work normally, but the second instance doesn’t launch until I close the main process. And if I call the method without getting the return value, everything works fine.
I also tried calling the function without getting the return value, but setting the blocking parameter to true, and it works exactly the same way as if I set it to false. But if blocking is true AND I set the return value to a variable, then my app freezes, and only when I close it, the second instance launches.
How can I have the second instance launch upon calling the method, access its stdio and pid, and not block the main process? According to the documentation, setting the parameter blocking to false should allow me to get pipe information immediately… am I missing something?
I even tried using threads with no succes (probably my fault) back in 4.3, when the method did not have a blocking parameter, and was blocking by default. I thought that with this new addition, creating threads became not necessary, but I’m still having the same problem I had before.
For comparison, OS.execute_with_pipe()
works similarly to OS.create_process()
, which is also non-blocking, creates a process independent of the main one, and returns something (the process ID). That function worked perfectly for me, but in order to add a new feature, I need the “stdio”, but OS.execute_with_pipe()
is just not working…
Code is not very relevant, but here it is… it runs on file dialog path selected, in the main thread:
MainUtils.process_info = OS.execute_with_pipe(
OS.get_executable_path(),
[EXPORT_SCENE,
"--path", frame_save_dir,
"--write-movie", png_filename + ".png",
"--resolution", "1280x720",
"--fixed-fps", "60",
"--",
"--load_preset=" + GlobalVariables.RENDER_PRESET_FILENAME
],
false)