Michalis Kamburelis wrote:
bobby wrote:
[...]
I already told you, the Lazarus Wiki example gives me the same
results like my code - 106kb and no byte more.
So it seems that you actually found two problems. To make things clear:
1. The problem with using TStringList.LoadFromStream to read from the
pipe. This is what me and Andrew are wandering about. This problem is
reproducible on Linux.
The current workaround for it is to read from the pipe using
TMemoryStream, like presented in the Wiki example. Then you can read
whole MemoryStream using StringList.LoadFromStream(MemoryStream), and
under Linux this works.
2. Your other problem seems to be Win32-specific. For me, under Linux,
Wiki example that uses TMemoryStream works perfectly. I also tested
testproc.pp code from your later letter, and it also works perfectly.
I'm testing this with command "cat /var/log/syslog" that returns 22 MB
text file.
So it seems that this is some Win32-specific problem -- sorry, I'm not
able to help you with this today, but I can suggest some workarounds.
If you will not manage to force ShellExecute to redirect output to a
file (I'm not sure if this is possible with ShellExecute) you can
a) use CreateProcess with appropriately created file handle -- you'll
have to read CreateProcess WinAPI docs, CreateProcess is the ultimate
way under Win32 to run a process (in fact, TProcess implementation
under Win32 uses CreateProcess call).
b) Ultra-simple workaround may be to create a temporary foo.bat file
on the fly, with contents like
prog.exe [attr] > output.log
then execute foo.bat using ExecuteProcess, and then delete foo.bat.
And then all you have to do is to read output.log file. This is ugly,
but should work.
Michalis
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives
Thanks about BAT-file suggestion, I have forgot about that/such solution :)
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives