Execute shell command with life output in DesktopTextArea

Good morning (o;

For a simple IDE like tool I need to call shell commands which report the actual progress or what step it is doing so I can display it in a console part:

The problem with shell.Execute is, that it:

  1. Blocks the GUI until the command is finished
  2. The whole output is only available when command has finished.


Is there a way to call the shell command and update a DesktopTextArea as soon it prints out a line of text?

thanks in advance

You need to change the mode of the shell to interactive. See https://documentation.xojo.com/api/os/shell.html#shell-executeMode .


One problem I see though with this…or don’t know if there is a workaround…

It can happen that the timer fires when the shell command is in the middle of outputting a line of text.
So the timer will capture half a line…

But maybe there’s a simple way to read until EOL in the timer?
But then again it would block the GUI…

you could subclass this shell and use the DataAvailable event/method.

Yes. Subclass the shell, and add to it:

  • a DataAvailable event
  • a string property called “Buffer”

In the dataAvailable event put this code:

Buffer = Buffer + me.ReadAll

In your timer Action event put this code:

TextArea1.AppendText sh.Buffer
sh.Buffer = ""

Ah great…thanks (o;

Guess I have to walk through some subclasses examples first as I am not really familiar with OOP…

If you start and control it from a thread then it won’t block the GUI.