I have this problem.
I need to Exec a command, writing to its standard input, then capturing what it writes to stdout.
I've been bouncing back and forth in the Gambas documentation wiki, without much success.
Dim proc As Process
proc = Exec [...] For Read Write
' this seems to work
proc.Begin()
Print #proc, "something"
proc.Send()
proc.Wait()
' Error: the stream is closed
If Lof(proc) Then myVar = Read #proc, Lof(proc)
'This also doesn't work: the stream is closed
For Each ostrega In proc.Lines
Print ostrega
Next
There is some code here in the wiki https://gambaswiki.org/wiki/lang/open which seems to align with the notion of "read events" I found here and there, which involves the definition of a sub called NAMEOFFILE_Read that is seemingly associated in a magic way to the file with the same name. But it looks like I cannot define a sub inside a sub, so I'm at a loss.
Any help is greatly appreciated.