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.

asked 20 Mar '11, 03:17

Zeokat's gravatar image

Zeokat
261
accept rate: 0%


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.

link

answered 20 Mar '11, 03:29

Zeokat's gravatar image

Zeokat
261
accept rate: 0%

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.

link

answered 21 Mar '11, 16:38

Lukas%20Matyska's gravatar image

Lukas Matyska ♦♦
90117
accept rate: 28%

Thanks for the reply, now all is clear. Thanks.

(22 Mar '11, 11:53) Zeokat
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×44
×4

Asked: 20 Mar '11, 03:17

Seen: 860 times

Last updated: 21 Mar '11, 16:38