I’ve got an OSX process I am running from Xojo, like this:
myShell = New Shell
myShell.Mode = 1 // async...will return
AddHandler myShell.DataAvailable, AddressOf ProcessOutput
myShell.Execute (myDirectory + "/myProcess &")
If myShell.isRunning Then
Msgbox "Process: " + Str(myShell.PID)
When I run this code, a process is created, and it reports the PID.
The process presumably prints out a string. If I run “./myProcess &” from the command line, it runs in the background and prints out a string.
But apparently DataAvailable never fires. I put a breakpoint in ProcessOutput, it doesn’t get there. It should put up a MsgBox…and none pops up. So I presume DataAvailable isn’t firing.
The docs I have looked at say nothing about the requirements for DataAvailable to fire. The program myProcess will print out one line of text with \r
at the end of it. Perhaps it needs a 0 terminator? Ctrl-Z perhaps? Is there any documentation on the form of the data required for DataAvailable? Or something else that might cause it not to fire?
BTW myShell is a property of the class, and ProcessOutput is a method of same class
Further to this, I’ve just added a timer calling myShell.Poll…no DataAvailable yet.
The class is a subclass of ContainerControl