+1 vote

After little fight with Kivy I have decide to rewrite my company inside render-manager in godot for simpler UI design and... Godot it's great ;)

But I have little problem, executing shell commands is very simple but how can I capture output from console? It's needed for controlling progress and errors. It's even possible?

in Engine by (227 points)

Never tried but can't you redirect the output to a file in user:// path?

1 Answer

+5 votes

Hand an array as the fourth argument to OS.execute. Each line of output will be added as an element to that array. For example:

var output = []
OS.execute( 'grep', ['-Irn', 'pattern', '.'], true, output )
for line in output:
    print( line )

Make sure to create the output array using [] and not Array(), only arrays created using [] are shared (see issue #5277)

by (1,086 points)

Is there any way to know if process has finished when using non-blocking exec?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.