0 votes
by (240 points)
edited

I testing the example included WinFormRExec, i´m trying to use curl but seems impossible receive output correctly.

I´m using a simple command with curl:

curl -o filesumi.bin http://web.com/file100mb.bin

If i use:

string line = shell.ReadLine();

It reads first two lines of curl output but the progress (next lines) aren´t show showed in real time, they are showed at once at the end when curl finish.

I know that curl writes output using StandardError and not StandardOutput, perhaps it´s the problem.

Anyways if you know how to capture in real time curl output will be very usefull for my project.

Thanks in advance for your help.

2 Answers

+1 vote
by (240 points)
edited

Well... after research a few, seems that exists shell.ReadChar() , and this captures correctly the curl ouput, don´t know exactly why shell.ReadLine() fails.

Anyways i think that can solve situation with ReadChar().

Again answering myself :P , perhpaps it can be usefull for other users.

Thanks anyways.

+1 vote
by (72.7k points)
edited

The curl command displays the current state of the transfer on a line without sending the Line Feed character (LF - 0x0A) until the process is finshed.

The Shell.ReadLine() method reads the output up to the first occurance of the LF character. If the process takes long time the ReadLine method times out (no LF is received during the transfer).

On the other hand, the Shell.ReadChar() method reads from output immediately if any character is available. So if the characters are received continuously during a transfer the Timeout exception doesn't appear.

by (240 points)
Thanks for the reply, now all is clear. Thanks.
...