often when I use RunProgram() and I have to deal with the output of the program, I did not get all the
stuff which is written in a cmd window.
For example:
I can fetch the line with 'password:' via AvailableProgramOutput() and ReadProgramData()c:\Program Files (x86)\PuTTY>plink -ssh -pw wrongpassword root@192.168.0.1 "tcpdump -ni eth0 -s 0 -U -w - not port 22"
Access denied
root@217.113.176.50's password:
But the line with 'Access denied' is not fetchable with this nor with ReadProgramError()
Code: Select all
Parameter$ = "-ssh -pw wrongpassword root@192.168.0.1 "
Parameter$ + #DQUOTE$
Parameter$ + "tcpdump -ni eth0 -s 0 -U -w - not port 22"
Parameter$ + #DQUOTE$
PLink = RunProgram("c:\Program Files (x86)\PuTTY\plink.exe", Parameter$, "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Write|#PB_Program_Error)
If IsProgram(PLink)
*Buffer = AllocateMemory(4096)
If *Buffer
Repeat
Error$ = ReadProgramError(PLink)
If Len(Error$)
Debug "stderr: " + Error$
EndIf
AvailableData = AvailableProgramOutput(PLink)
If AvailableData
If AvailableData > MemorySize(*Buffer)
AvailableData = MemorySize(*Buffer)
EndIf
ReadProgramData(PLink, *Buffer, AvailableData)
Debug "stdout: " + PeekS(*Buffer, AvailableData, #PB_UTF8)
EndIf
Until Len(Error$)
FreeMemory(*Buffer)
EndIf
EndIf
Or it is a bug, but other stuff send to stderr is readable, for example if tcpdump is not installed on the PC.
So I don't think it's a bug.
Bernd