0 votes

Hi
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?

asked Jan 9 in Engine by websterek (104 points)

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

1 Answer

+2 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)

answered Jan 10 by eska (686 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.