11-14-2023, 09:52 PM
Fix I used was here, to make certain that things get evaluated in order:
Code: (Select All)
WHILE 1
'While ReadFile(hStdOutPipeRead, _Offset(buf), 4096, _Offset(dwRead), 0) <> 0 And dwRead > 0
x = ReadFile(hStdOutPipeRead, _OFFSET(buf), 4096, _OFFSET(dwRead), 0)
IF x <> 0 AND dwRead > 0 THEN
buf = MID$(buf, 1, dwRead)
GOSUB RemoveChr13
stdout = stdout + buf
buf = SPACE$(4096 + 1)
ELSE
EXIT WHILE
END IF
WEND
WHILE 1
x = ReadFile(hStdReadPipeError, _OFFSET(buf), 4096, _OFFSET(dwRead), 0)
IF x <> 0 AND dwRead > 0 THEN
buf = MID$(buf, 1, dwRead)
GOSUB RemoveChr13
stderr = stderr + buf
buf = SPACE$(4096 + 1)
ELSE
EXIT FUNCTION
END IF
WEND