I have got into using this quite extensively. However some calls fail and some succeed. This is in a For...Next loop so it is unlikely to be a syntax error on my side. Also I have trapped the failure on a variety of other calls.
Essentially the first one or two calls to the RUN function when $STDOUT_CHILD etc is specified works fine, and mostly the second one works. But the third, or 4th become dodgy.
At one point I thought I had this down to every alternate call would fail, but it is not that simple.
I was musing that there might be a race condition, such that my code:
$Pid=Run($Cmd,$Dir,$Flag,$STDERR_CHILD+$STDOUT_CHILD)
While True
$OutText=StdoutRead($Pid)
If @error=-1 Then ExitLoop
$OutTextAll &= $OutText
WEnd
While True
$ErrText=StderrRead($Pid)
If @error=-1 Then ExitLoop
$ErrTextAll &= $ErrText
WEnd might fail because Run is an independent process.
Further exhaustive tests show that there is a real runtime problem here. I have tried using processclosewait() on my PID, to no avail. Has anyone any insights? Right now I have put a loop saying "have I retrieved the data (since I knowit exists), if not then re-run the RUN command and get the output again! Not ideal obviously.
Andy